-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Replace invalid Lookup.resolveGroup usage with resolve #14595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,9 +26,8 @@ | |
| import io.trino.sql.planner.plan.UnionNode; | ||
|
|
||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import static com.google.common.collect.Iterables.getOnlyElement; | ||
| import static com.google.common.collect.ImmutableList.toImmutableList; | ||
| import static io.trino.sql.planner.plan.ChildReplacer.replaceChildren; | ||
| import static io.trino.sql.planner.plan.Patterns.aggregation; | ||
|
|
||
|
|
@@ -51,9 +50,9 @@ public Result apply(AggregationNode node, Captures captures, Context context) | |
| DistinctAggregationRewriter rewriter = new DistinctAggregationRewriter(lookup); | ||
|
|
||
| List<PlanNode> newSources = node.getSources().stream() | ||
| .flatMap(lookup::resolveGroup) | ||
| .map(lookup::resolve) | ||
|
lukasz-stec marked this conversation as resolved.
Outdated
|
||
| .map(source -> source.accept(rewriter, true)) | ||
| .collect(Collectors.toList()); | ||
| .collect(toImmutableList()); | ||
|
|
||
| if (rewriter.isRewritten()) { | ||
| return Result.ofPlanNode(replaceChildren(node, newSources)); | ||
|
|
@@ -86,8 +85,9 @@ public boolean isRewritten() | |
| private PlanNode rewriteChildren(PlanNode node, Boolean context) | ||
| { | ||
| List<PlanNode> newSources = node.getSources().stream() | ||
| .flatMap(lookup::resolveGroup) | ||
| .map(source -> source.accept(this, context)).collect(Collectors.toList()); | ||
| .map(lookup::resolve) | ||
| .map(source -> source.accept(this, context)) | ||
| .collect(toImmutableList()); | ||
|
|
||
| return replaceChildren(node, newSources); | ||
| } | ||
|
|
@@ -128,8 +128,7 @@ public PlanNode visitAggregation(AggregationNode node, Boolean context) | |
| { | ||
| boolean distinct = isDistinctOperator(node); | ||
|
|
||
| PlanNode rewrittenNode = getOnlyElement(lookup.resolveGroup(node.getSource()) | ||
| .map(source -> source.accept(this, distinct)).collect(Collectors.toList())); | ||
| PlanNode rewrittenNode = lookup.resolve(node.getSource()).accept(this, distinct); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Separate this from "Replace invalid resolveGroup usage with resolve" commit. This wasn't incorrect. That was just overly verbose, i.e. using
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to "Deduplicate Lookup.resolve copies" commit |
||
|
|
||
| if (context && distinct) { | ||
| this.rewritten = true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate this from "Replace invalid resolveGroup usage with resolve" commit.
This place wasn't incorrect.
it was actually correct, and just working around the (premature) deprecation of
resolveGroup, doing same logic asresolve, but with a local (non deprecated) helper methodThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to "Deduplicate Lookup.resolve copies" commit