Search in sources :

Example 61 with TimeseriesQuery

use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.

the class HllSketchAggregatorFactoryTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count"), new HllSketchBuildAggregatorFactory("hllBuild", "col", null, null, false), new HllSketchBuildAggregatorFactory("hllBuildRound", "col", null, null, true), new HllSketchMergeAggregatorFactory("hllMerge", "col", null, null, false), new HllSketchMergeAggregatorFactory("hllMergeRound", "col", null, null, true)).postAggregators(new FieldAccessPostAggregator("hllBuild-access", "hllBuild"), new FinalizingFieldAccessPostAggregator("hllBuild-finalize", "hllBuild"), new FieldAccessPostAggregator("hllBuildRound-access", "hllBuildRound"), new FinalizingFieldAccessPostAggregator("hllBuildRound-finalize", "hllBuildRound"), new FieldAccessPostAggregator("hllMerge-access", "hllMerge"), new FinalizingFieldAccessPostAggregator("hllMerge-finalize", "hllMerge"), new FieldAccessPostAggregator("hllMergeRound-access", "hllMergeRound"), new FinalizingFieldAccessPostAggregator("hllMergeRound-finalize", "hllMergeRound")).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("hllBuild", null).add("hllBuildRound", null).add("hllMerge", null).add("hllMergeRound", null).add("hllBuild-access", HllSketchBuildAggregatorFactory.TYPE).add("hllBuild-finalize", ColumnType.DOUBLE).add("hllBuildRound-access", HllSketchBuildAggregatorFactory.TYPE).add("hllBuildRound-finalize", ColumnType.LONG).add("hllMerge-access", HllSketchMergeAggregatorFactory.TYPE).add("hllMerge-finalize", ColumnType.DOUBLE).add("hllMergeRound-access", HllSketchMergeAggregatorFactory.TYPE).add("hllMergeRound-finalize", ColumnType.LONG).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Also used : FinalizingFieldAccessPostAggregator(org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator) FieldAccessPostAggregator(org.apache.druid.query.aggregation.post.FieldAccessPostAggregator) TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) CountAggregatorFactory(org.apache.druid.query.aggregation.CountAggregatorFactory) FinalizingFieldAccessPostAggregator(org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) Test(org.junit.Test)

Example 62 with TimeseriesQuery

use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.

the class ArrayOfDoublesSketchTTestPostAggregatorTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count")).postAggregators(new ArrayOfDoublesSketchTTestPostAggregator("a", ImmutableList.of(new ConstantPostAggregator("", 0), new ConstantPostAggregator("", 0)))).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ColumnType.DOUBLE_ARRAY).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Also used : TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) CountAggregatorFactory(org.apache.druid.query.aggregation.CountAggregatorFactory) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) Test(org.junit.Test)

Example 63 with TimeseriesQuery

use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.

the class ArrayOfDoublesSketchToEstimatePostAggregatorTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count")).postAggregators(new ArrayOfDoublesSketchToEstimatePostAggregator("a", new ConstantPostAggregator("", 0))).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ColumnType.DOUBLE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Also used : TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) CountAggregatorFactory(org.apache.druid.query.aggregation.CountAggregatorFactory) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) Test(org.junit.Test)

Example 64 with TimeseriesQuery

use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.

the class ArrayOfDoublesSketchToQuantilesSketchPostAggregatorTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count")).postAggregators(new ArrayOfDoublesSketchToQuantilesSketchPostAggregator("a", new ConstantPostAggregator("", 0), 2, null)).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ArrayOfDoublesSketchModule.MERGE_TYPE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Also used : TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) CountAggregatorFactory(org.apache.druid.query.aggregation.CountAggregatorFactory) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) Test(org.junit.Test)

Example 65 with TimeseriesQuery

use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.

the class ArrayOfDoublesSketchToStringPostAggregatorTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count")).postAggregators(new ArrayOfDoublesSketchToStringPostAggregator("a", new ConstantPostAggregator("", 1))).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ColumnType.STRING).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Also used : TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) CountAggregatorFactory(org.apache.druid.query.aggregation.CountAggregatorFactory) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) Test(org.junit.Test)

Aggregations

TimeseriesQuery (org.apache.druid.query.timeseries.TimeseriesQuery)130 Test (org.junit.Test)109 TimeseriesQueryQueryToolChest (org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest)58 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)50 Result (org.apache.druid.query.Result)39 TimeseriesResultValue (org.apache.druid.query.timeseries.TimeseriesResultValue)35 LongSumAggregatorFactory (org.apache.druid.query.aggregation.LongSumAggregatorFactory)29 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)25 QueryRunner (org.apache.druid.query.QueryRunner)22 FinalizeResultsQueryRunner (org.apache.druid.query.FinalizeResultsQueryRunner)21 FieldAccessPostAggregator (org.apache.druid.query.aggregation.post.FieldAccessPostAggregator)17 Interval (org.joda.time.Interval)17 TimeseriesQueryEngine (org.apache.druid.query.timeseries.TimeseriesQueryEngine)15 TimeseriesQueryRunnerFactory (org.apache.druid.query.timeseries.TimeseriesQueryRunnerFactory)15 ArrayList (java.util.ArrayList)13 FinalizingFieldAccessPostAggregator (org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator)13 DateTime (org.joda.time.DateTime)12 Sequence (org.apache.druid.java.util.common.guava.Sequence)11 IOException (java.io.IOException)10 SpatialDimFilter (org.apache.druid.query.filter.SpatialDimFilter)9