Search in sources :

Example 6 with FragmentSearchQuerySpec

use of io.druid.query.search.search.FragmentSearchQuerySpec in project druid by druid-io.

the class SearchQuerySpecDimExtractionFnTest method testSerde.

@Test
public void testSerde() throws Exception {
    ObjectMapper objectMapper = new DefaultObjectMapper();
    SearchQuerySpec spec = new FragmentSearchQuerySpec(Arrays.asList("to", "yo"), true);
    ExtractionFn extractionFn = new SearchQuerySpecDimExtractionFn(spec);
    ExtractionFn extractionFn2 = objectMapper.readValue(objectMapper.writeValueAsBytes(extractionFn), ExtractionFn.class);
    FragmentSearchQuerySpec spec2 = (FragmentSearchQuerySpec) ((SearchQuerySpecDimExtractionFn) extractionFn2).getSearchQuerySpec();
    Assert.assertEquals(extractionFn, extractionFn2);
    Assert.assertEquals(true, spec2.isCaseSensitive());
    Assert.assertEquals(ImmutableList.of("to", "yo"), spec2.getValues());
}
Also used : FragmentSearchQuerySpec(io.druid.query.search.search.FragmentSearchQuerySpec) SearchQuerySpec(io.druid.query.search.search.SearchQuerySpec) FragmentSearchQuerySpec(io.druid.query.search.search.FragmentSearchQuerySpec) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

FragmentSearchQuerySpec (io.druid.query.search.search.FragmentSearchQuerySpec)6 Test (org.junit.Test)6 SearchQuerySpec (io.druid.query.search.search.SearchQuerySpec)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)2 SearchHit (io.druid.query.search.search.SearchHit)2 SearchQuery (io.druid.query.search.search.SearchQuery)2 Result (io.druid.query.Result)1 TableDataSource (io.druid.query.TableDataSource)1 MultipleIntervalSegmentSpec (io.druid.query.spec.MultipleIntervalSegmentSpec)1 DateTime (org.joda.time.DateTime)1 Interval (org.joda.time.Interval)1