Search in sources :

Example 11 with TimeBoundaryQuery

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

the class AppendTest method testTimeBoundary2.

@Test
public void testTimeBoundary2() {
    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-15T00:00:00.000Z")))));
    TimeBoundaryQuery query = Druids.newTimeBoundaryQueryBuilder().dataSource(dataSource).build();
    QueryRunner runner = TestQueryRunners.makeTimeBoundaryQueryRunner(segment2);
    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)

Example 12 with TimeBoundaryQuery

use of io.druid.query.timeboundary.TimeBoundaryQuery 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

TimeBoundaryQuery (io.druid.query.timeboundary.TimeBoundaryQuery)12 Interval (org.joda.time.Interval)8 Test (org.junit.Test)8 Result (io.druid.query.Result)7 DateTime (org.joda.time.DateTime)7 HashMap (java.util.HashMap)6 QueryableDruidServer (io.druid.client.selector.QueryableDruidServer)5 MultipleIntervalSegmentSpec (io.druid.query.spec.MultipleIntervalSegmentSpec)5 TimeBoundaryResultValue (io.druid.query.timeboundary.TimeBoundaryResultValue)5 List (java.util.List)5 HttpClient (com.metamx.http.client.HttpClient)4 HighestPriorityTierSelectorStrategy (io.druid.client.selector.HighestPriorityTierSelectorStrategy)4 ServerSelector (io.druid.client.selector.ServerSelector)4 QueryRunner (io.druid.query.QueryRunner)4 DataSegment (io.druid.timeline.DataSegment)4 Request (com.metamx.http.client.Request)3 HttpResponseHandler (com.metamx.http.client.response.HttpResponseHandler)3 ConnectionCountServerSelectorStrategy (io.druid.client.selector.ConnectionCountServerSelectorStrategy)3 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)3 Sequence (io.druid.java.util.common.guava.Sequence)3