use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class AggregatorUtilTest method testOutOfOrderPruneDependentPostAgg.
@Test
public void testOutOfOrderPruneDependentPostAgg() {
PostAggregator agg1 = new ArithmeticPostAggregator("abc", "+", Lists.newArrayList(new ConstantPostAggregator("1", 1L), new ConstantPostAggregator("2", 2L)));
PostAggregator dependency1 = new ArithmeticPostAggregator("dep1", "+", Lists.newArrayList(new ConstantPostAggregator("1", 1L), new ConstantPostAggregator("4", 4L)));
PostAggregator agg2 = new FieldAccessPostAggregator("def", "def");
PostAggregator dependency2 = new FieldAccessPostAggregator("dep2", "dep2");
PostAggregator aggregator = new ArithmeticPostAggregator("finalAgg", "+", Lists.newArrayList(new FieldAccessPostAggregator("dep1", "dep1"), new FieldAccessPostAggregator("dep2", "dep2")));
List<PostAggregator> prunedAgg = AggregatorUtil.pruneDependentPostAgg(Lists.newArrayList(agg1, dependency1, // dependency is added later than the aggregator
aggregator, agg2, dependency2), aggregator.getName());
Assert.assertEquals(Lists.newArrayList(dependency1, aggregator), prunedAgg);
}
Aggregations