From 5e80f1e7c8a29c94356b8cfa16c5127c670af0c1 Mon Sep 17 00:00:00 2001 From: kasiafi <30203062+kasiafi@users.noreply.github.com> Date: Fri, 27 Sep 2019 08:39:45 +0200 Subject: [PATCH] Reuse original node Ids --- .../io/prestosql/sql/planner/SubqueryPlanner.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/presto-main/src/main/java/io/prestosql/sql/planner/SubqueryPlanner.java b/presto-main/src/main/java/io/prestosql/sql/planner/SubqueryPlanner.java index de6f66946aa5..ac9d681f5e6f 100644 --- a/presto-main/src/main/java/io/prestosql/sql/planner/SubqueryPlanner.java +++ b/presto-main/src/main/java/io/prestosql/sql/planner/SubqueryPlanner.java @@ -521,7 +521,7 @@ private PlanNode replaceExpressionsWithSymbols(PlanNode planNode, Map { - private final PlanNodeIdAllocator idAllocator; private final Map, Expression> mapping; - public ExpressionReplacer(PlanNodeIdAllocator idAllocator, Map, Expression> mapping) + public ExpressionReplacer(Map, Expression> mapping) { - this.idAllocator = requireNonNull(idAllocator, "idAllocator is null"); this.mapping = requireNonNull(mapping, "mapping is null"); } @@ -574,14 +572,14 @@ public PlanNode visitProject(ProjectNode node, RewriteContext context) Assignments assignments = rewrittenNode.getAssignments() .rewrite(expression -> replaceExpression(expression, mapping)); - return new ProjectNode(idAllocator.getNextId(), rewrittenNode.getSource(), assignments); + return new ProjectNode(node.getId(), rewrittenNode.getSource(), assignments); } @Override public PlanNode visitFilter(FilterNode node, RewriteContext context) { FilterNode rewrittenNode = (FilterNode) context.defaultRewrite(node); - return new FilterNode(idAllocator.getNextId(), rewrittenNode.getSource(), replaceExpression(rewrittenNode.getPredicate(), mapping)); + return new FilterNode(node.getId(), rewrittenNode.getSource(), replaceExpression(rewrittenNode.getPredicate(), mapping)); } @Override @@ -594,7 +592,7 @@ public PlanNode visitValues(ValuesNode node, RewriteContext context) .collect(toImmutableList())) .collect(toImmutableList()); return new ValuesNode( - idAllocator.getNextId(), + node.getId(), rewrittenNode.getOutputSymbols(), rewrittenRows); }