Skip to content

Commit

Permalink
Ensure proper rule application order
Browse files Browse the repository at this point in the history
Before the change, the rule `ImplementOffsetOverOther`
could be applied too early, and thus suppress creation
of a mandatory SortNode in the resulting plan.
  • Loading branch information
kasiafi authored and martint committed May 11, 2019
1 parent 488ce45 commit 09759d2
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,14 @@ public PlanOptimizers(
new ImplementOffsetOverTopN(),
new ImplementOffsetOverProjectTopN(),
new ImplementOffsetOverSort(),
new ImplementOffsetOverProjectSort(),
new ImplementOffsetOverOther())),
new ImplementOffsetOverProjectSort())),
new IterativeOptimizer(
ruleStats,
statsCalculator,
estimatedExchangesCostCalculator,
// Temporary hack: separate optimizer step to avoid a plan that's missing a SortNode over a RowNumber node
// if the rules fires too early
ImmutableSet.of(new ImplementOffsetOverOther())),
simplifyOptimizer,
new UnaliasSymbolReferences(),
new IterativeOptimizer(
Expand Down

0 comments on commit 09759d2

Please sign in to comment.