Skip to content

Commit c7802a5

Browse files
committed
Add additional runs of columnPruningRules and WindowFilterPushDown
1 parent 5bbdf93 commit c7802a5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

presto-main-base/src/main/java/com/facebook/presto/sql/planner/PlanOptimizers.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,14 @@ public PlanOptimizers(
733733
builder.add(new SimplifyPlanWithEmptyInput(),
734734
new PruneUnreferencedOutputs());
735735

736+
// Run columnPruningRules one more time to optimize the ProjectNode generated in SimplifyPlanWithEmptyInput.
737+
builder.add(new IterativeOptimizer(
738+
metadata,
739+
ruleStats,
740+
statsCalculator,
741+
estimatedExchangesCostCalculator,
742+
columnPruningRules));
743+
736744
builder.add(new IterativeOptimizer(
737745
metadata,
738746
ruleStats,
@@ -886,6 +894,7 @@ public PlanOptimizers(
886894
// Run RemoveEmptyDelete and EliminateEmptyJoins after table scan is removed by PickTableLayout/AddExchanges
887895
ImmutableSet.of(new RemoveEmptyDelete())));
888896
builder.add(predicatePushDown); // Run predicate push down one more time in case we can leverage new information from layouts' effective predicate
897+
builder.add(new WindowFilterPushDown(metadata));
889898
builder.add(new RemoveUnsupportedDynamicFilters(metadata.getFunctionAndTypeManager()));
890899
builder.add(simplifyRowExpressionOptimizer); // Should be always run after PredicatePushDown
891900
builder.add(projectionPushDown);

presto-main-base/src/main/java/com/facebook/presto/sql/planner/optimizations/WindowFilterPushDown.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import static com.facebook.presto.common.type.BigintType.BIGINT;
5252
import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT;
5353
import static com.facebook.presto.sql.planner.plan.ChildReplacer.replaceChildren;
54-
import static com.google.common.base.Preconditions.checkState;
5554
import static com.google.common.base.Verify.verify;
5655
import static com.google.common.collect.Iterables.getOnlyElement;
5756
import static java.lang.Math.toIntExact;
@@ -116,7 +115,6 @@ public boolean isPlanChanged()
116115
@Override
117116
public PlanNode visitWindow(WindowNode node, RewriteContext<Void> context)
118117
{
119-
checkState(node.getWindowFunctions().size() == 1, "WindowFilterPushdown requires that WindowNodes contain exactly one window function");
120118
PlanNode rewrittenSource = context.rewrite(node.getSource());
121119

122120
if (canReplaceWithRowNumber(node, metadata.getFunctionAndTypeManager())) {

0 commit comments

Comments
 (0)