use of io.druid.query.search.SearchResultValue in project druid by druid-io.
the class ServerManagerTest method assertQueryable.
private <T> Future assertQueryable(Granularity granularity, String dataSource, Interval interval, List<Pair<String, Interval>> expected) {
final Iterator<Pair<String, Interval>> expectedIter = expected.iterator();
final List<Interval> intervals = Arrays.asList(interval);
final SearchQuery query = Druids.newSearchQueryBuilder().dataSource(dataSource).intervals(intervals).granularity(granularity).limit(10000).query("wow").build();
final QueryRunner<Result<SearchResultValue>> runner = serverManager.getQueryRunnerForIntervals(query, intervals);
return serverManagerExec.submit(new Runnable() {
@Override
public void run() {
Map<String, Object> context = new HashMap<String, Object>();
Sequence<Result<SearchResultValue>> seq = runner.run(query, context);
Sequences.toList(seq, Lists.<Result<SearchResultValue>>newArrayList());
Iterator<SegmentForTesting> adaptersIter = factory.getAdapters().iterator();
while (expectedIter.hasNext() && adaptersIter.hasNext()) {
Pair<String, Interval> expectedVals = expectedIter.next();
SegmentForTesting value = adaptersIter.next();
Assert.assertEquals(expectedVals.lhs, value.getVersion());
Assert.assertEquals(expectedVals.rhs, value.getInterval());
}
Assert.assertFalse(expectedIter.hasNext());
Assert.assertFalse(adaptersIter.hasNext());
}
});
}
use of io.druid.query.search.SearchResultValue in project druid by druid-io.
the class AppendTest method testSearch.
@Test
public void testSearch() {
List<Result<SearchResultValue>> expectedResults = Arrays.asList(new Result<SearchResultValue>(new DateTime("2011-01-12T00:00:00.000Z"), new SearchResultValue(Arrays.<SearchHit>asList(new SearchHit(placementishDimension, "a"), new SearchHit(qualityDimension, "automotive"), new SearchHit(placementDimension, "mezzanine"), new SearchHit(marketDimension, "total_market")))));
SearchQuery query = makeSearchQuery();
QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment);
HashMap<String, Object> context = new HashMap<String, Object>();
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
}
use of io.druid.query.search.SearchResultValue in project druid by druid-io.
the class SchemalessTestFullTest method testFullOnSearch.
private void testFullOnSearch(QueryRunner runner, List<Result<SearchResultValue>> expectedResults, String failMsg) {
SearchQuery query = Druids.newSearchQueryBuilder().dataSource(dataSource).granularity(allGran).intervals(fullOnInterval).query("a").build();
failMsg += " search ";
HashMap<String, Object> context = new HashMap<>();
Iterable<Result<SearchResultValue>> actualResults = Sequences.toList(runner.run(query, context), Lists.<Result<SearchResultValue>>newArrayList());
TestHelper.assertExpectedResults(expectedResults, actualResults, failMsg);
}
use of io.druid.query.search.SearchResultValue in project druid by druid-io.
the class SchemalessTestSimpleTest method testFullOnSearch.
@Test
public void testFullOnSearch() {
SearchQuery query = Druids.newSearchQueryBuilder().dataSource(dataSource).granularity(allGran).intervals(fullOnInterval).query("a").build();
List<Result<SearchResultValue>> expectedResults = Arrays.asList(new Result<SearchResultValue>(new DateTime("2011-01-12T00:00:00.000Z"), new SearchResultValue(Arrays.<SearchHit>asList(new SearchHit(placementishDimension, "a"), new SearchHit(qualityDimension, "automotive"), new SearchHit(placementDimension, "mezzanine"), new SearchHit(marketDimension, "total_market")))));
QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment);
HashMap<String, Object> context = new HashMap<String, Object>();
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
}
use of io.druid.query.search.SearchResultValue in project druid by druid-io.
the class AppendTest method testFilteredSearch2.
@Test
public void testFilteredSearch2() {
List<Result<SearchResultValue>> expectedResults = Arrays.asList(new Result<SearchResultValue>(new DateTime("2011-01-12T00:00:00.000Z"), new SearchResultValue(Arrays.<SearchHit>asList(new SearchHit(placementishDimension, "a"), new SearchHit(placementDimension, "mezzanine"), new SearchHit(marketDimension, "total_market")))));
SearchQuery query = makeFilteredSearchQuery();
QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment2);
HashMap<String, Object> context = new HashMap<String, Object>();
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
}
Aggregations