-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ESQL: Fix incorrectly optimized fork with nullify unmapped_fields #143030
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
02f92ee
7df7ea6
d292b63
b803604
dcc1b98
1449883
307bfe0
610f4f9
ac5eed1
c1a58cc
41be8c4
a6c6677
7b9baf1
c757dd5
9525d79
3c2398c
47e8c56
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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| pr: 143030 | ||
| summary: "ESQL: Fix incorrectly optimized fork with nullify unmapped_fields" | ||
| area: ES|QL | ||
| type: bug | ||
| issues: | ||
| - 142762 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ | |
| import java.util.stream.Collectors; | ||
|
|
||
| import static org.elasticsearch.xpack.esql.analysis.Analyzer.NO_FIELDS; | ||
| import static org.elasticsearch.xpack.esql.core.expression.Expressions.toReferenceAttributes; | ||
| import static org.elasticsearch.xpack.esql.core.expression.Expressions.toReferenceAttributesPreservingIds; | ||
|
|
||
| /** | ||
| * A Fork is a n-ary {@code Plan} where each child is a sub plan, e.g. | ||
|
|
@@ -105,13 +105,11 @@ public Fork replaceSubPlansAndOutput(List<LogicalPlan> subPlans, List<Attribute> | |
| } | ||
|
|
||
| public Fork refreshOutput() { | ||
| // We don't want to keep the same attributes that are outputted by the FORK branches. | ||
| // Keeping the same attributes can have unintended side effects when applying optimizations like constant folding. | ||
| return new Fork(source(), children(), refreshedOutput()); | ||
| } | ||
|
|
||
| protected List<Attribute> refreshedOutput() { | ||
| return toReferenceAttributes(outputUnion(children())); | ||
| return toReferenceAttributesPreservingIds(outputUnion(children()), this.output()); | ||
|
Contributor
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. Hmm, this no longer refreshes the IDs. Meaning that some assumptions are either broken, or they were incorrect to have, or they're no longer valid (in the meantime).
Contributor
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. @bpintea can you expand on this, please? What use cases would this impact/break/change? (are we missing tests?) |
||
| } | ||
|
|
||
| @Override | ||
|
|
||
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.
This shouldn't be removed. The attribute IDs from within the branches are not kept / reused atop Fork.