Package io.druid.query

Examples of io.druid.query.TableDataSource


  @Test
  public void testMergeResultsEmptyResults() throws Exception
  {
    List<Result<TimeBoundaryResultValue>> results = Lists.newArrayList();

    TimeBoundaryQuery query = new TimeBoundaryQuery(new TableDataSource("test"), null, null, null);
    Iterable<Result<TimeBoundaryResultValue>> actual = query.mergeResults(results);

    Assert.assertFalse(actual.iterator().hasNext());
  }
View Full Code Here


  {
    TimeseriesQuery query = Druids.newTimeseriesQueryBuilder()
                                  .dataSource(
                                      new UnionDataSource(
                                          Lists.newArrayList(
                                              new TableDataSource("ds1"),
                                              new TableDataSource("ds2")
                                          )
                                      )
                                  )
                                  .granularity(QueryRunnerTestHelper.dayGran)
                                  .intervals(QueryRunnerTestHelper.firstToThird)
                                  .aggregators(
                                      Arrays.<AggregatorFactory>asList(
                                          QueryRunnerTestHelper.rowsCount,
                                          new LongSumAggregatorFactory(
                                              "idx",
                                              "index"
                                          )
                                      )
                                  )
                                  .build();
    QueryToolChest toolChest = new TimeseriesQueryQueryToolChest(new QueryConfig());
    QueryRunner mergingrunner = toolChest.mergeResults(
        new UnionQueryRunner<Result<TimeseriesResultValue>>(
            new QueryRunner<Result<TimeseriesResultValue>>()
            {
              @Override
              public Sequence<Result<TimeseriesResultValue>> run(Query<Result<TimeseriesResultValue>> query,
                                                                 Map<String, Object> context)
              {
                if (query.getDataSource().equals(new TableDataSource("ds1"))) {
                  return Sequences.simple(
                      Lists.newArrayList(
                          new Result<TimeseriesResultValue>(
                              new DateTime("2011-04-02"),
                              new TimeseriesResultValue(
View Full Code Here

TOP

Related Classes of io.druid.query.TableDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.