Skip to content
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

Remove unnecessary usage of Coalesce for InnerJoin #24534

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ public RelationPlan plan(QuerySpecification node)

// The new scope is the composite of the fields from the FROM and SELECT clause (local nested scopes). Fields from the bottom of
// the scope stack need to be placed first to match the expected layout for nested scopes.
List<Symbol> newFields = new ArrayList<>();
newFields.addAll(builder.getTranslations().getFieldSymbols());
List<Symbol> newFields = new ArrayList<>(builder.getTranslations().getFieldSymbols());

outputs.stream()
.map(builder::translate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,9 +1179,14 @@ If casts are redundant (due to column type and common type being equal),
for (Identifier column : joinColumns) {
Symbol output = symbolAllocator.newSymbol(column.getValue(), analysis.getType(column));
outputs.add(output);
assignments.put(output, new Coalesce(
leftJoinColumns.get(column).toSymbolReference(),
rightJoinColumns.get(column).toSymbolReference()));
if (join.getType() == JoinType.INNER) {
assignments.put(output, leftJoinColumns.get(column).toSymbolReference());
}
else {
assignments.put(output, new Coalesce(
leftJoinColumns.get(column).toSymbolReference(),
rightJoinColumns.get(column).toSymbolReference()));
}
}

for (int field : joinAnalysis.getOtherLeftFields()) {
Expand Down
Loading