use of com.facebook.presto.SystemSessionProperties.PARTIAL_AGGREGATION_STRATEGY in project presto by prestodb.
the class TestPushPartialAggregationThroughExchange method testPartialAggregationEnabledWhenNotConfident.
@Test
public void testPartialAggregationEnabledWhenNotConfident() {
tester().assertThat(new PushPartialAggregationThroughExchange(getFunctionManager())).setSystemProperty(PARTIAL_AGGREGATION_STRATEGY, "AUTOMATIC").on(p -> {
VariableReferenceExpression a = p.variable("a", DOUBLE);
VariableReferenceExpression b = p.variable("b", DOUBLE);
return p.aggregation(ab -> ab.source(p.exchange(e -> e.addSource(p.values(new PlanNodeId("values"), a, b)).addInputsSet(a, b).singleDistributionPartitioningScheme(a, b))).addAggregation(p.variable("SUM", DOUBLE), expression("SUM(a)"), ImmutableList.of(DOUBLE)).singleGroupingSet(b).step(PARTIAL));
}).overrideStats("values", PlanNodeStatsEstimate.builder().setOutputRowCount(1000).addVariableStatistics(variable("b", DOUBLE), new VariableStatsEstimate(0, 100, 0, 8, 800)).setConfident(false).build()).matches(exchange(project(aggregation(ImmutableMap.of("SUM", functionCall("sum", ImmutableList.of("a"))), PARTIAL, values("a", "b")))));
}
use of com.facebook.presto.SystemSessionProperties.PARTIAL_AGGREGATION_STRATEGY in project presto by prestodb.
the class TestPushPartialAggregationThroughExchange method testNoPartialAggregationWhenReductionBelowThreshold.
@Test
public void testNoPartialAggregationWhenReductionBelowThreshold() {
tester().assertThat(new PushPartialAggregationThroughExchange(getFunctionManager())).setSystemProperty(PARTIAL_AGGREGATION_STRATEGY, "AUTOMATIC").on(p -> {
VariableReferenceExpression a = p.variable("a", DOUBLE);
VariableReferenceExpression b = p.variable("b", DOUBLE);
return p.aggregation(ab -> ab.source(p.exchange(e -> e.addSource(p.values(new PlanNodeId("values"), a, b)).addInputsSet(a, b).singleDistributionPartitioningScheme(a, b))).addAggregation(p.variable("SUM", DOUBLE), expression("SUM(a)"), ImmutableList.of(DOUBLE)).singleGroupingSet(b).step(SINGLE));
}).overrideStats("values", PlanNodeStatsEstimate.builder().setOutputRowCount(1000).addVariableStatistics(variable("b", DOUBLE), new VariableStatsEstimate(0, 100, 0, 8, 800)).setConfident(true).build()).doesNotFire();
}
Aggregations