use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class BloomFilterAggregatorFactoryTest method testResultArraySignature.
@Test
public void testResultArraySignature() {
final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count"), new BloomFilterAggregatorFactory("bloom", DefaultDimensionSpec.of("col"), 1024), new BloomFilterMergeAggregatorFactory("bloomMerge", "bloom", 1024)).postAggregators(new FieldAccessPostAggregator("bloom-access", "bloom"), new FinalizingFieldAccessPostAggregator("bloom-finalize", "bloom"), new FieldAccessPostAggregator("bloomMerge-access", "bloomMerge"), new FinalizingFieldAccessPostAggregator("bloomMerge-finalize", "bloomMerge")).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("bloom", BloomFilterAggregatorFactory.TYPE).add("bloomMerge", BloomFilterAggregatorFactory.TYPE).add("bloom-access", BloomFilterAggregatorFactory.TYPE).add("bloom-finalize", BloomFilterAggregatorFactory.TYPE).add("bloomMerge-access", BloomFilterAggregatorFactory.TYPE).add("bloomMerge-finalize", BloomFilterAggregatorFactory.TYPE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class ApproximateHistogramAggregatorTest method testResultArraySignature.
@Test
public void testResultArraySignature() {
final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new ApproximateHistogramAggregatorFactory("approxHisto", "col", null, null, null, null, false), new ApproximateHistogramAggregatorFactory("approxHistoBin", "col", null, null, null, null, true)).postAggregators(new FieldAccessPostAggregator("approxHisto-access", "approxHisto"), new FinalizingFieldAccessPostAggregator("approxHisto-finalize", "approxHisto"), new FieldAccessPostAggregator("approxHistoBin-access", "approxHistoBin"), new FinalizingFieldAccessPostAggregator("approxHistoBin-finalize", "approxHistoBin")).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("approxHisto", null).add("approxHistoBin", ApproximateHistogramAggregatorFactory.TYPE).add("approxHisto-access", ApproximateHistogramAggregatorFactory.TYPE).add("approxHisto-finalize", HistogramAggregatorFactory.TYPE).add("approxHistoBin-access", ApproximateHistogramAggregatorFactory.TYPE).add("approxHistoBin-finalize", ApproximateHistogramAggregatorFactory.TYPE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class FixedBucketsHistogramBufferAggregatorTest method testResultArraySignature.
@Test
public void testResultArraySignature() {
final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new FixedBucketsHistogramAggregatorFactory("fixedHisto", "col", null, 0, 100, null, false), new FixedBucketsHistogramAggregatorFactory("fixedHistoBin", "col", null, 0, 100, null, true)).postAggregators(new FieldAccessPostAggregator("fixedHisto-access", "fixedHisto"), new FinalizingFieldAccessPostAggregator("fixedHisto-finalize", "fixedHisto"), new FieldAccessPostAggregator("fixedHistoBin-access", "fixedHistoBin"), new FinalizingFieldAccessPostAggregator("fixedHistoBin-finalize", "fixedHistoBin")).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("fixedHisto", null).add("fixedHistoBin", FixedBucketsHistogramAggregator.TYPE).add("fixedHisto-access", FixedBucketsHistogramAggregator.TYPE).add("fixedHisto-finalize", ColumnType.STRING).add("fixedHistoBin-access", FixedBucketsHistogramAggregator.TYPE).add("fixedHistoBin-finalize", FixedBucketsHistogramAggregator.TYPE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class FixedBucketsHistogramQuantileSqlAggregatorTest method testQuantileOnInnerQuery.
@Test
public void testQuantileOnInnerQuery() throws Exception {
final List<Object[]> expectedResults;
if (NullHandling.replaceWithDefault()) {
expectedResults = ImmutableList.of(new Object[] { 7.0, 11.940000534057617 });
} else {
expectedResults = ImmutableList.of(new Object[] { 5.25, 8.920000076293945 });
}
testQuery("SELECT AVG(x), APPROX_QUANTILE_FIXED_BUCKETS(x, 0.98, 100, 0.0, 100.0)\n" + "FROM (SELECT dim2, SUM(m1) AS x FROM foo GROUP BY dim2)", ImmutableList.of(GroupByQuery.builder().setDataSource(new QueryDataSource(GroupByQuery.builder().setDataSource(CalciteTests.DATASOURCE1).setInterval(new MultipleIntervalSegmentSpec(ImmutableList.of(Filtration.eternity()))).setGranularity(Granularities.ALL).setDimensions(new DefaultDimensionSpec("dim2", "d0")).setAggregatorSpecs(ImmutableList.of(new DoubleSumAggregatorFactory("a0", "m1"))).setContext(QUERY_CONTEXT_DEFAULT).build())).setInterval(new MultipleIntervalSegmentSpec(ImmutableList.of(Filtration.eternity()))).setGranularity(Granularities.ALL).setAggregatorSpecs(new DoubleSumAggregatorFactory("_a0:sum", "a0"), new CountAggregatorFactory("_a0:count"), new FixedBucketsHistogramAggregatorFactory("_a1:agg", "a0", 100, 0, 100.0d, FixedBucketsHistogram.OutlierHandlingMode.IGNORE, false)).setPostAggregatorSpecs(ImmutableList.of(new ArithmeticPostAggregator("_a0", "quotient", ImmutableList.of(new FieldAccessPostAggregator(null, "_a0:sum"), new FieldAccessPostAggregator(null, "_a0:count"))), new QuantilePostAggregator("_a1", "_a1:agg", 0.98f))).setContext(QUERY_CONTEXT_DEFAULT).build()), expectedResults);
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class TimestampMinMaxAggregatorFactoryTest method testResultArraySignature.
@Test
public void testResultArraySignature() {
final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count"), new TimestampMaxAggregatorFactory("timeMax", "__time", null), new TimestampMinAggregatorFactory("timeMin", "__time", null)).postAggregators(new FieldAccessPostAggregator("timeMax-access", "timeMax"), new FinalizingFieldAccessPostAggregator("timeMax-finalize", "timeMax"), new FieldAccessPostAggregator("timeMin-access", "timeMin"), new FinalizingFieldAccessPostAggregator("timeMin-finalize", "timeMin")).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("timeMax", null).add("timeMin", null).add("timeMax-access", ColumnType.LONG).add("timeMax-finalize", TimestampAggregatorFactory.FINALIZED_TYPE).add("timeMin-access", ColumnType.LONG).add("timeMin-finalize", TimestampAggregatorFactory.FINALIZED_TYPE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Aggregations