-
Notifications
You must be signed in to change notification settings - Fork 26k
ESQL: Fix variable shadowing when pushing down past Project #108360
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
Merged
alex-spies
merged 42 commits into
elastic:main
from
alex-spies:fix-pushdown-past-project-shadowing
Jul 23, 2024
Merged
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
2554ee1
Add reproducing tests
alex-spies 16dc1ff
Turn RegexExtract extracted fields into Aliases
alex-spies c6396fc
Fix pushDownPastProject
alex-spies 79a2f2d
Fix physical planning/optimization
alex-spies 2979314
Merge remote-tracking branch 'upstream/main' into fix-pushdown-past-p…
alex-spies 96c55b3
Merge branch 'main' into fix-pushdown-past-project-shadowing
alex-spies f21e47b
Merge remote-tracking branch 'upstream/main' into fix-pushdown-past-p…
alex-spies 717f9cd
Make tests deterministic
alex-spies 7a74e46
Update StatementParserTests
alex-spies c456b2f
Update unit tests
alex-spies 06cd647
Fix withGeneratedNames for Eval
alex-spies dbe12b6
Unit test: pushdown shadowing eval past project
alex-spies dce915f
Generalize unit test, add DISSECT
alex-spies c9b94e8
Add test cases for grok and enrich
alex-spies c061b64
Improve comment
alex-spies b93f481
Align push down past order by with new approach
alex-spies 3684d13
Merge remote-tracking branch 'upstream/main' into fix-pushdown-past-p…
alex-spies dd6abad
Revert to previous push down past order by
alex-spies 2ac1257
Use different names without new transport version
alex-spies ac31ef4
Update tests
alex-spies b87ae72
Merge remote-tracking branch 'upstream/main' into fix-pushdown-past-p…
alex-spies fc5fec5
Move randomConfiguration() back
alex-spies c8dd4a6
Improve comments
alex-spies 7f3f7b9
Add capability
alex-spies 28c2606
Update javadoc
alex-spies 28477a9
Refactor a bit
alex-spies b1c0d7b
Move raw name mechanism to LogicalPlanOptimizer
alex-spies 8fc9c03
Make temp names unique locally on a node
alex-spies d939a4d
Simplify leftovers
alex-spies 23769d2
Add test for simpler case
alex-spies efbc2dd
Simplify optimization for case without renames
alex-spies c80ddf4
Remove leftover
alex-spies 1fa5462
Update docs/changelog/108360.yaml
alex-spies 4e8f828
Add simpler tests
alex-spies 17cfbc8
Merge remote-tracking branch 'upstream/main' into fix-pushdown-past-p…
alex-spies f904f54
Apply remarks
alex-spies 33e8ac4
Make unit tests a bit spicier
alex-spies edd2f7f
Moar tests
alex-spies 32c5fba
Merge remote-tracking branch 'upstream/main' into fix-pushdown-past-p…
alex-spies 73ba36c
Move dissect pattern validation back into parsing
alex-spies db3304d
DRY
alex-spies 984bd98
Fix test
alex-spies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/GeneratingPlan.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.esql.plan; | ||
|
|
||
| import org.elasticsearch.xpack.ql.expression.Alias; | ||
| import org.elasticsearch.xpack.ql.expression.Attribute; | ||
| import org.elasticsearch.xpack.ql.expression.NameId; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| public interface GeneratingPlan<PlanType extends GeneratingPlan<PlanType>> { | ||
|
alex-spies marked this conversation as resolved.
|
||
| List<Attribute> generatedAttributes(); | ||
|
|
||
| PlanType withGeneratedNames(List<String> newNames); | ||
|
|
||
| static List<Alias> renameAliases(List<Alias> originalAliases, List<String> newNames) { | ||
| if (newNames.size() != originalAliases.size()) { | ||
| throw new IllegalArgumentException( | ||
| "Number of new names is [" + newNames.size() + "] but there are [" + originalAliases.size() + "] names." | ||
| ); | ||
| } | ||
|
|
||
| List<Alias> newFields = new ArrayList<>(originalAliases.size()); | ||
| for (int i = 0; i < originalAliases.size(); i++) { | ||
| Alias field = originalAliases.get(i); | ||
| String newName = newNames.get(i); | ||
| if (field.name().equals(newName)) { | ||
| newFields.add(field); | ||
| } else { | ||
| newFields.add(new Alias(field.source(), newName, field.qualifier(), field.child(), new NameId(), field.synthetic())); | ||
| } | ||
| } | ||
|
|
||
| return newFields; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.