18
18
import com .facebook .presto .cost .CostComparator ;
19
19
import com .facebook .presto .cost .StatsCalculator ;
20
20
import com .facebook .presto .cost .TaskCountEstimator ;
21
+ import com .facebook .presto .execution .TaskManagerConfig ;
21
22
import com .facebook .presto .metadata .Metadata ;
22
23
import com .facebook .presto .split .PageSourceManager ;
23
24
import com .facebook .presto .split .SplitManager ;
27
28
import com .facebook .presto .sql .planner .iterative .IterativeOptimizer ;
28
29
import com .facebook .presto .sql .planner .iterative .Rule ;
29
30
import com .facebook .presto .sql .planner .iterative .properties .LogicalPropertiesProviderImpl ;
31
+ import com .facebook .presto .sql .planner .iterative .rule .AddExchangesBelowPartialAggregationOverGroupIdRuleSet ;
30
32
import com .facebook .presto .sql .planner .iterative .rule .AddIntermediateAggregations ;
31
33
import com .facebook .presto .sql .planner .iterative .rule .AddNotNullFiltersToJoinNode ;
32
34
import com .facebook .presto .sql .planner .iterative .rule .CombineApproxPercentileFunctions ;
@@ -222,7 +224,8 @@ public PlanOptimizers(
222
224
TaskCountEstimator taskCountEstimator ,
223
225
PartitioningProviderManager partitioningProviderManager ,
224
226
FeaturesConfig featuresConfig ,
225
- ExpressionOptimizerManager expressionOptimizerManager )
227
+ ExpressionOptimizerManager expressionOptimizerManager ,
228
+ TaskManagerConfig taskManagerConfig )
226
229
{
227
230
this (metadata ,
228
231
sqlParser ,
@@ -238,7 +241,8 @@ public PlanOptimizers(
238
241
taskCountEstimator ,
239
242
partitioningProviderManager ,
240
243
featuresConfig ,
241
- expressionOptimizerManager );
244
+ expressionOptimizerManager ,
245
+ taskManagerConfig );
242
246
}
243
247
244
248
@ PostConstruct
@@ -270,7 +274,8 @@ public PlanOptimizers(
270
274
TaskCountEstimator taskCountEstimator ,
271
275
PartitioningProviderManager partitioningProviderManager ,
272
276
FeaturesConfig featuresConfig ,
273
- ExpressionOptimizerManager expressionOptimizerManager )
277
+ ExpressionOptimizerManager expressionOptimizerManager ,
278
+ TaskManagerConfig taskManagerConfig )
274
279
{
275
280
this .exporter = exporter ;
276
281
ImmutableList .Builder <PlanOptimizer > builder = ImmutableList .builder ();
@@ -820,6 +825,7 @@ public PlanOptimizers(
820
825
821
826
if (!noExchange ) {
822
827
builder .add (new ReplicateSemiJoinInDelete ()); // Must run before AddExchanges
828
+
823
829
builder .add (new IterativeOptimizer (
824
830
metadata ,
825
831
ruleStats ,
@@ -830,6 +836,7 @@ public PlanOptimizers(
830
836
// Must run before AddExchanges and after ReplicateSemiJoinInDelete
831
837
// to avoid temporarily having an invalid plan
832
838
new DetermineSemiJoinDistributionType (costComparator , taskCountEstimator ))));
839
+
833
840
builder .add (new RandomizeNullKeyInOuterJoin (metadata .getFunctionAndTypeManager (), statsCalculator ),
834
841
new PruneUnreferencedOutputs (),
835
842
new IterativeOptimizer (
@@ -841,6 +848,7 @@ public PlanOptimizers(
841
848
new PruneRedundantProjectionAssignments (),
842
849
new InlineProjections (metadata .getFunctionAndTypeManager ()),
843
850
new RemoveRedundantIdentityProjections ())));
851
+
844
852
builder .add (new ShardJoins (metadata , metadata .getFunctionAndTypeManager (), statsCalculator ),
845
853
new PruneUnreferencedOutputs ());
846
854
builder .add (
@@ -914,6 +922,13 @@ public PlanOptimizers(
914
922
ImmutableSet .of (
915
923
new PruneJoinColumns ())));
916
924
925
+ builder .add (new IterativeOptimizer (
926
+ metadata ,
927
+ ruleStats ,
928
+ statsCalculator ,
929
+ costCalculator ,
930
+ new AddExchangesBelowPartialAggregationOverGroupIdRuleSet (taskCountEstimator , taskManagerConfig , metadata , sqlParser ).rules ()));
931
+
917
932
builder .add (new IterativeOptimizer (
918
933
metadata ,
919
934
ruleStats ,
0 commit comments