Search in sources :

Example 6 with TimeBoundaryResultValue

use of io.druid.query.timeboundary.TimeBoundaryResultValue in project druid by druid-io.

the class AppendTest method testTimeBoundary.

@Test
public void testTimeBoundary() {
    List<Result<TimeBoundaryResultValue>> expectedResults = Arrays.asList(new Result<TimeBoundaryResultValue>(new DateTime("2011-01-12T00:00:00.000Z"), new TimeBoundaryResultValue(ImmutableMap.of(TimeBoundaryQuery.MIN_TIME, new DateTime("2011-01-12T00:00:00.000Z"), TimeBoundaryQuery.MAX_TIME, new DateTime("2011-01-15T02:00:00.000Z")))));
    TimeBoundaryQuery query = Druids.newTimeBoundaryQueryBuilder().dataSource(dataSource).build();
    QueryRunner runner = TestQueryRunners.makeTimeBoundaryQueryRunner(segment);
    HashMap<String, Object> context = new HashMap<String, Object>();
    TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
}
Also used : HashMap(java.util.HashMap) TimeBoundaryResultValue(io.druid.query.timeboundary.TimeBoundaryResultValue) TimeBoundaryQuery(io.druid.query.timeboundary.TimeBoundaryQuery) DateTime(org.joda.time.DateTime) QueryRunner(io.druid.query.QueryRunner) Result(io.druid.query.Result) Test(org.junit.Test)

Aggregations

TimeBoundaryResultValue (io.druid.query.timeboundary.TimeBoundaryResultValue)6 TimeBoundaryQuery (io.druid.query.timeboundary.TimeBoundaryQuery)5 DateTime (org.joda.time.DateTime)5 Result (io.druid.query.Result)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 QueryRunner (io.druid.query.QueryRunner)3 Interval (org.joda.time.Interval)2 MapBasedRow (io.druid.data.input.MapBasedRow)1 Sequence (io.druid.java.util.common.guava.Sequence)1 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)1 CountAggregatorFactory (io.druid.query.aggregation.CountAggregatorFactory)1 MultipleIntervalSegmentSpec (io.druid.query.spec.MultipleIntervalSegmentSpec)1 TimeseriesResultValue (io.druid.query.timeseries.TimeseriesResultValue)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Period (org.joda.time.Period)1