Search in sources :

Example 1 with AGGREGATION_PARTITIONING_MERGING_STRATEGY

use of com.facebook.presto.SystemSessionProperties.AGGREGATION_PARTITIONING_MERGING_STRATEGY in project presto by prestodb.

the class TestAddExchangesPlans method assertPlanWithMergePartitionStrategy.

private void assertPlanWithMergePartitionStrategy(String sql, String partitionMergingStrategy, int remoteRepartitionExchangeCount, PlanMatchPattern pattern) {
    Session session = Session.builder(this.getQueryRunner().getDefaultSession()).setSystemProperty(AGGREGATION_PARTITIONING_MERGING_STRATEGY, partitionMergingStrategy).setSystemProperty(TASK_CONCURRENCY, "2").build();
    BiConsumer<Plan, Integer> validateMultipleRemoteRepartitionExchange = (plan, count) -> assertEquals(searchFrom(plan.getRoot()).where(node -> node instanceof ExchangeNode && ((ExchangeNode) node).getScope() == REMOTE_STREAMING && ((ExchangeNode) node).getType() == REPARTITION).count(), count.intValue());
    assertPlanWithSession(sql, session, false, pattern, plan -> validateMultipleRemoteRepartitionExchange.accept(plan, remoteRepartitionExchangeCount));
}
Also used : ALL(com.facebook.presto.execution.QueryManagerConfig.ExchangeMaterializationStrategy.ALL) AggregationNode(com.facebook.presto.spi.plan.AggregationNode) BasePlanTest(com.facebook.presto.sql.planner.assertions.BasePlanTest) PlanMatchPattern.anyTree(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.anyTree) GroupIdNode(com.facebook.presto.sql.planner.plan.GroupIdNode) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) SINGLE(com.facebook.presto.spi.plan.AggregationNode.Step.SINGLE) TestingSession(com.facebook.presto.testing.TestingSession) PlanMatchPattern(com.facebook.presto.sql.planner.assertions.PlanMatchPattern) PlanMatchPattern.join(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.join) PlanMatchPattern.singleGroupingSet(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.singleGroupingSet) AGGREGATION_PARTITIONING_MERGING_STRATEGY(com.facebook.presto.SystemSessionProperties.AGGREGATION_PARTITIONING_MERGING_STRATEGY) ImmutableList(com.google.common.collect.ImmutableList) PREFER_EXACT_PARTITIONING(com.facebook.presto.sql.analyzer.FeaturesConfig.PartitioningPrecisionStrategy.PREFER_EXACT_PARTITIONING) LOCAL(com.facebook.presto.sql.planner.plan.ExchangeNode.Scope.LOCAL) REPARTITION(com.facebook.presto.sql.planner.plan.ExchangeNode.Type.REPARTITION) PlanMatchPattern.equiJoinClause(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.equiJoinClause) BiConsumer(java.util.function.BiConsumer) Plan(com.facebook.presto.sql.planner.Plan) PlanMatchPattern.aggregation(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.aggregation) PlanNodeSearcher.searchFrom(com.facebook.presto.sql.planner.optimizations.PlanNodeSearcher.searchFrom) FunctionCall(com.facebook.presto.sql.tree.FunctionCall) EXCHANGE_MATERIALIZATION_STRATEGY(com.facebook.presto.SystemSessionProperties.EXCHANGE_MATERIALIZATION_STRATEGY) ImmutableMap(com.google.common.collect.ImmutableMap) PlanMatchPattern.semiJoin(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.semiJoin) Session(com.facebook.presto.Session) ELIMINATE_CROSS_JOINS(com.facebook.presto.sql.analyzer.FeaturesConfig.JoinReorderingStrategy.ELIMINATE_CROSS_JOINS) PlanMatchPattern.tableScan(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.tableScan) PlanMatchPattern.anySymbol(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.anySymbol) PlanMatchPattern.exchange(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.exchange) JOIN_DISTRIBUTION_TYPE(com.facebook.presto.SystemSessionProperties.JOIN_DISTRIBUTION_TYPE) USE_STREAMING_EXCHANGE_FOR_MARK_DISTINCT(com.facebook.presto.SystemSessionProperties.USE_STREAMING_EXCHANGE_FOR_MARK_DISTINCT) PARTITIONING_PRECISION_STRATEGY(com.facebook.presto.SystemSessionProperties.PARTITIONING_PRECISION_STRATEGY) TASK_CONCURRENCY(com.facebook.presto.SystemSessionProperties.TASK_CONCURRENCY) PARTITIONED(com.facebook.presto.sql.analyzer.FeaturesConfig.JoinDistributionType.PARTITIONED) REMOTE_STREAMING(com.facebook.presto.sql.planner.plan.ExchangeNode.Scope.REMOTE_STREAMING) JOIN_REORDERING_STRATEGY(com.facebook.presto.SystemSessionProperties.JOIN_REORDERING_STRATEGY) REMOTE_MATERIALIZED(com.facebook.presto.sql.planner.plan.ExchangeNode.Scope.REMOTE_MATERIALIZED) Optional(java.util.Optional) PlanMatchPattern.values(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.values) ExpectedValueProvider(com.facebook.presto.sql.planner.assertions.ExpectedValueProvider) ExchangeNode(com.facebook.presto.sql.planner.plan.ExchangeNode) PlanMatchPattern.node(com.facebook.presto.sql.planner.assertions.PlanMatchPattern.node) INNER(com.facebook.presto.sql.planner.plan.JoinNode.Type.INNER) ExchangeNode(com.facebook.presto.sql.planner.plan.ExchangeNode) Plan(com.facebook.presto.sql.planner.Plan) TestingSession(com.facebook.presto.testing.TestingSession) Session(com.facebook.presto.Session)

Aggregations

Session (com.facebook.presto.Session)1 AGGREGATION_PARTITIONING_MERGING_STRATEGY (com.facebook.presto.SystemSessionProperties.AGGREGATION_PARTITIONING_MERGING_STRATEGY)1 EXCHANGE_MATERIALIZATION_STRATEGY (com.facebook.presto.SystemSessionProperties.EXCHANGE_MATERIALIZATION_STRATEGY)1 JOIN_DISTRIBUTION_TYPE (com.facebook.presto.SystemSessionProperties.JOIN_DISTRIBUTION_TYPE)1 JOIN_REORDERING_STRATEGY (com.facebook.presto.SystemSessionProperties.JOIN_REORDERING_STRATEGY)1 PARTITIONING_PRECISION_STRATEGY (com.facebook.presto.SystemSessionProperties.PARTITIONING_PRECISION_STRATEGY)1 TASK_CONCURRENCY (com.facebook.presto.SystemSessionProperties.TASK_CONCURRENCY)1 USE_STREAMING_EXCHANGE_FOR_MARK_DISTINCT (com.facebook.presto.SystemSessionProperties.USE_STREAMING_EXCHANGE_FOR_MARK_DISTINCT)1 ALL (com.facebook.presto.execution.QueryManagerConfig.ExchangeMaterializationStrategy.ALL)1 AggregationNode (com.facebook.presto.spi.plan.AggregationNode)1 SINGLE (com.facebook.presto.spi.plan.AggregationNode.Step.SINGLE)1 PARTITIONED (com.facebook.presto.sql.analyzer.FeaturesConfig.JoinDistributionType.PARTITIONED)1 ELIMINATE_CROSS_JOINS (com.facebook.presto.sql.analyzer.FeaturesConfig.JoinReorderingStrategy.ELIMINATE_CROSS_JOINS)1 PREFER_EXACT_PARTITIONING (com.facebook.presto.sql.analyzer.FeaturesConfig.PartitioningPrecisionStrategy.PREFER_EXACT_PARTITIONING)1 Plan (com.facebook.presto.sql.planner.Plan)1 BasePlanTest (com.facebook.presto.sql.planner.assertions.BasePlanTest)1 ExpectedValueProvider (com.facebook.presto.sql.planner.assertions.ExpectedValueProvider)1 PlanMatchPattern (com.facebook.presto.sql.planner.assertions.PlanMatchPattern)1 PlanMatchPattern.aggregation (com.facebook.presto.sql.planner.assertions.PlanMatchPattern.aggregation)1 PlanMatchPattern.anySymbol (com.facebook.presto.sql.planner.assertions.PlanMatchPattern.anySymbol)1