use of io.druid.query.search.search.SearchQuery in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchSameValueInMultiDims.
@Test
public void testSearchSameValueInMultiDims() {
SearchQuery searchQuery = Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).intervals(QueryRunnerTestHelper.fullOnInterval).dimensions(Arrays.asList(QueryRunnerTestHelper.placementDimension, QueryRunnerTestHelper.placementishDimension)).query("e").build();
List<SearchHit> expectedHits = Lists.newLinkedList();
expectedHits.add(new SearchHit(QueryRunnerTestHelper.placementDimension, "preferred", 1209));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.placementishDimension, "e", 93));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.placementishDimension, "preferred", 1209));
checkSearchQuery(searchQuery, expectedHits);
}
use of io.druid.query.search.search.SearchQuery in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchWithExtractionFilter1.
@Test
public void testSearchWithExtractionFilter1() {
final String automotiveSnowman = "automotive☃";
List<SearchHit> expectedHits = Lists.newLinkedList();
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, automotiveSnowman, 93));
final LookupExtractionFn lookupExtractionFn = new LookupExtractionFn(new MapLookupExtractor(ImmutableMap.of("automotive", automotiveSnowman), false), true, null, true, true);
SearchQuery query = Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).filters(new ExtractionDimFilter(QueryRunnerTestHelper.qualityDimension, automotiveSnowman, lookupExtractionFn, null)).intervals(QueryRunnerTestHelper.fullOnInterval).dimensions(new ExtractionDimensionSpec(QueryRunnerTestHelper.qualityDimension, null, lookupExtractionFn)).query("☃").build();
checkSearchQuery(query, expectedHits);
}
use of io.druid.query.search.search.SearchQuery in project druid by druid-io.
the class SearchQueryRunnerWithCaseTest method testSearchIntervals.
@Test
public void testSearchIntervals() {
SearchQuery searchQuery;
Druids.SearchQueryBuilder builder = testBuilder().dimensions(Arrays.asList(qualityDimension)).intervals("2011-01-12T00:00:00.000Z/2011-01-13T00:00:00.000Z");
Map<String, Set<String>> expectedResults = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
searchQuery = builder.query("otive").build();
expectedResults.put(qualityDimension, Sets.newHashSet("AutoMotive"));
checkSearchQuery(searchQuery, expectedResults);
}
use of io.druid.query.search.search.SearchQuery in project druid by druid-io.
the class SearchQueryRunnerWithCaseTest method testSearchNoOverrappingIntervals.
@Test
public void testSearchNoOverrappingIntervals() {
SearchQuery searchQuery;
Druids.SearchQueryBuilder builder = testBuilder().dimensions(Arrays.asList(qualityDimension)).intervals("2011-01-10T00:00:00.000Z/2011-01-11T00:00:00.000Z");
Map<String, Set<String>> expectedResults = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
searchQuery = builder.query("business").build();
expectedResults.put(qualityDimension, Sets.<String>newHashSet());
checkSearchQuery(searchQuery, expectedResults);
}
use of io.druid.query.search.search.SearchQuery in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchWithNotExistedDimension.
@Test
public void testSearchWithNotExistedDimension() throws Exception {
SearchQuery searchQuery = Druids.newSearchQueryBuilder().dimensions(new DefaultDimensionSpec("asdf", "asdf")).dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).intervals(QueryRunnerTestHelper.fullOnInterval).build();
List<SearchHit> noHit = Lists.newLinkedList();
checkSearchQuery(searchQuery, noHit);
}
Aggregations