Search in sources :

Example 26 with TimeseriesQueryQueryToolChest

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

the class SketchAggregatorFactoryTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count"), new OldSketchBuildAggregatorFactory("oldBuild", "col", 16), new OldSketchMergeAggregatorFactory("oldMerge", "col", 16, false), new OldSketchMergeAggregatorFactory("oldMergeFinalize", "col", 16, true), new SketchMergeAggregatorFactory("merge", "col", 16, false, false, null), new SketchMergeAggregatorFactory("mergeFinalize", "col", 16, true, false, null)).postAggregators(new FieldAccessPostAggregator("oldBuild-access", "oldBuild"), new FinalizingFieldAccessPostAggregator("oldBuild-finalize", "oldBuild"), new FieldAccessPostAggregator("oldMerge-access", "oldMerge"), new FinalizingFieldAccessPostAggregator("oldMerge-finalize", "oldMerge"), new FieldAccessPostAggregator("oldMergeFinalize-access", "oldMergeFinalize"), new FinalizingFieldAccessPostAggregator("oldMergeFinalize-finalize", "oldMergeFinalize"), new FieldAccessPostAggregator("merge-access", "merge"), new FinalizingFieldAccessPostAggregator("merge-finalize", "merge"), new FieldAccessPostAggregator("mergeFinalize-access", "mergeFinalize"), new FinalizingFieldAccessPostAggregator("mergeFinalize-finalize", "mergeFinalize"), new SketchEstimatePostAggregator("sketchEstimate", new FieldAccessPostAggregator(null, "merge"), null), new SketchEstimatePostAggregator("sketchEstimateStdDev", new FieldAccessPostAggregator(null, "merge"), 2), new SketchSetPostAggregator("sketchSet", "UNION", null, ImmutableList.of(new FieldAccessPostAggregator(null, "oldMerge"), new FieldAccessPostAggregator(null, "merge"))), new SketchToStringPostAggregator("sketchString", new FieldAccessPostAggregator(null, "merge"))).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("oldBuild", null).add("oldMerge", SketchModule.MERGE_TYPE).add("oldMergeFinalize", null).add("merge", SketchModule.BUILD_TYPE).add("mergeFinalize", null).add("oldBuild-access", SketchModule.BUILD_TYPE).add("oldBuild-finalize", ColumnType.DOUBLE).add("oldMerge-access", SketchModule.MERGE_TYPE).add("oldMerge-finalize", SketchModule.MERGE_TYPE).add("oldMergeFinalize-access", SketchModule.MERGE_TYPE).add("oldMergeFinalize-finalize", ColumnType.DOUBLE).add("merge-access", SketchModule.BUILD_TYPE).add("merge-finalize", SketchModule.BUILD_TYPE).add("mergeFinalize-access", SketchModule.BUILD_TYPE).add("mergeFinalize-finalize", ColumnType.DOUBLE).add("sketchEstimate", ColumnType.DOUBLE).add("sketchEstimateStdDev", SketchModule.MERGE_TYPE).add("sketchSet", SketchModule.MERGE_TYPE).add("sketchString", ColumnType.STRING).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Also used : OldSketchMergeAggregatorFactory(org.apache.druid.query.aggregation.datasketches.theta.oldapi.OldSketchMergeAggregatorFactory) 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) OldSketchMergeAggregatorFactory(org.apache.druid.query.aggregation.datasketches.theta.oldapi.OldSketchMergeAggregatorFactory) FinalizingFieldAccessPostAggregator(org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) OldSketchBuildAggregatorFactory(org.apache.druid.query.aggregation.datasketches.theta.oldapi.OldSketchBuildAggregatorFactory) Test(org.junit.Test)

Example 27 with TimeseriesQueryQueryToolChest

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

the class DoublesSketchAggregatorFactoryTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count"), new DoublesSketchAggregatorFactory("doublesSketch", "col", 8), new DoublesSketchMergeAggregatorFactory("doublesSketchMerge", 8)).postAggregators(new FieldAccessPostAggregator("doublesSketch-access", "doublesSketch"), new FinalizingFieldAccessPostAggregator("doublesSketch-finalize", "doublesSketch"), new FieldAccessPostAggregator("doublesSketchMerge-access", "doublesSketchMerge"), new FinalizingFieldAccessPostAggregator("doublesSketchMerge-finalize", "doublesSketchMerge")).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("doublesSketch", null).add("doublesSketchMerge", null).add("doublesSketch-access", DoublesSketchModule.TYPE).add("doublesSketch-finalize", ColumnType.LONG).add("doublesSketchMerge-access", DoublesSketchModule.TYPE).add("doublesSketchMerge-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 28 with TimeseriesQueryQueryToolChest

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

the class DoublesSketchToRankPostAggregatorTest method testResultArraySignature.

@Test
public void testResultArraySignature() {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new DoublesSketchAggregatorFactory("sketch", "col", 8)).postAggregators(new DoublesSketchToRankPostAggregator("a", new FieldAccessPostAggregator("field", "sketch"), 4)).build();
    Assert.assertEquals(RowSignature.builder().addTimeColumn().add("sketch", null).add("a", ColumnType.DOUBLE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Also used : FieldAccessPostAggregator(org.apache.druid.query.aggregation.post.FieldAccessPostAggregator) TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) Test(org.junit.Test)

Example 29 with TimeseriesQueryQueryToolChest

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

the class HllSketchToEstimatePostAggregatorTest method testResultArraySignature.

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

Example 30 with TimeseriesQueryQueryToolChest

use of org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest 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)

Aggregations

TimeseriesQueryQueryToolChest (org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest)71 TimeseriesQuery (org.apache.druid.query.timeseries.TimeseriesQuery)62 Test (org.junit.Test)62 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)41 FinalizeResultsQueryRunner (org.apache.druid.query.FinalizeResultsQueryRunner)21 TimeseriesQueryEngine (org.apache.druid.query.timeseries.TimeseriesQueryEngine)20 TimeseriesQueryRunnerFactory (org.apache.druid.query.timeseries.TimeseriesQueryRunnerFactory)20 QueryRunner (org.apache.druid.query.QueryRunner)18 LongSumAggregatorFactory (org.apache.druid.query.aggregation.LongSumAggregatorFactory)18 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)18 FieldAccessPostAggregator (org.apache.druid.query.aggregation.post.FieldAccessPostAggregator)17 TimeseriesResultValue (org.apache.druid.query.timeseries.TimeseriesResultValue)17 Result (org.apache.druid.query.Result)15 FinalizingFieldAccessPostAggregator (org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator)13 IOException (java.io.IOException)11 Druids (org.apache.druid.query.Druids)10 SpatialDimFilter (org.apache.druid.query.filter.SpatialDimFilter)9 ConstantPostAggregator (org.apache.druid.query.aggregation.post.ConstantPostAggregator)8 AggregatorFactory (org.apache.druid.query.aggregation.AggregatorFactory)6 SelectorDimFilter (org.apache.druid.query.filter.SelectorDimFilter)6