-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: tests for LOOKUP JOIN with non-unique join keys #118471
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
elasticsearchmachine
merged 8 commits into
elastic:main
from
alex-spies:lookup-join-non-unique-tests
Dec 13, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b2d5f52
Add tests with non-unique key in LU index
alex-spies a28cfa2
Merge remote-tracking branch 'upstream/main' into lookup-join-non-uni…
alex-spies dfaac5d
Denormalize data a little + add a field
alex-spies 9be6cb4
Merge remote-tracking branch 'upstream/main' into lookup-join-non-uni…
alex-spies 1d2d7c0
Merge branch 'main' into lookup-join-non-unique-tests
craigtaverner 4c4726d
Move new tests up
alex-spies a68e029
Merge remote-tracking branch 'upstream/main' into lookup-join-non-uni…
alex-spies 76a4a75
Merge remote-tracking branch 'upstream/main' into lookup-join-non-uni…
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
10 changes: 10 additions & 0 deletions
10
x-pack/plugin/esql/qa/testFixtures/src/main/resources/languages_non_unique_key.csv
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,10 @@ | ||
| language_code:integer,language_name:keyword,country:keyword | ||
| 1,English,Canada | ||
| 1,English, | ||
| 1,,United Kingdom | ||
| 1,English,United States of America | ||
| 2,German,[Germany,Austria] | ||
| 2,German,Switzerland | ||
| 2,German, | ||
| 4,Quenya, | ||
| 5,,Atlantis | ||
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 |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ | |
| // Reuses the sample dataset and commands from enrich.csv-spec | ||
| // | ||
|
|
||
| //TODO: this sometimes returns null instead of the looked up value (likely related to the execution order) | ||
|
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. I removed this in my PR too! |
||
| basicOnTheDataNode | ||
| required_capability: join_lookup_v5 | ||
|
|
||
|
|
@@ -102,6 +101,83 @@ emp_no:integer | language_code:integer | language_name:keyword | |
| 10003 | 4 | German | ||
| ; | ||
|
|
||
| nonUniqueLeftKeyOnTheDataNode | ||
| required_capability: join_lookup_v5 | ||
|
|
||
| FROM employees | ||
| | WHERE emp_no <= 10030 | ||
| | EVAL language_code = emp_no % 10 | ||
| | WHERE language_code < 3 | ||
| | LOOKUP JOIN languages_lookup ON language_code | ||
| | SORT emp_no | ||
| | KEEP emp_no, language_code, language_name | ||
| ; | ||
|
|
||
| emp_no:integer | language_code:integer | language_name:keyword | ||
| 10001 |1 | English | ||
| 10002 |2 | French | ||
| 10010 |0 | null | ||
| 10011 |1 | English | ||
| 10012 |2 | French | ||
| 10020 |0 | null | ||
| 10021 |1 | English | ||
| 10022 |2 | French | ||
| 10030 |0 | null | ||
| ; | ||
|
|
||
| nonUniqueRightKeyOnTheDataNode | ||
| required_capability: join_lookup_v5 | ||
|
|
||
| FROM employees | ||
| | EVAL language_code = emp_no % 10 | ||
| | LOOKUP JOIN languages_lookup_non_unique_key ON language_code | ||
| | WHERE emp_no > 10090 AND emp_no < 10096 | ||
| | SORT emp_no | ||
| | EVAL country = MV_SORT(country) | ||
| | KEEP emp_no, language_code, language_name, country | ||
| ; | ||
|
|
||
| emp_no:integer | language_code:integer | language_name:keyword | country:keyword | ||
| 10091 | 1 | [English, English, English] | [Canada, United Kingdom, United States of America] | ||
| 10092 | 2 | [German, German, German] | [Austria, Germany, Switzerland] | ||
| 10093 | 3 | null | null | ||
| 10094 | 4 | Quenya | null | ||
| 10095 | 5 | null | Atlantis | ||
| ; | ||
|
|
||
| nonUniqueRightKeyOnTheCoordinator | ||
| required_capability: join_lookup_v5 | ||
|
|
||
| FROM employees | ||
| | SORT emp_no | ||
| | LIMIT 5 | ||
| | EVAL language_code = emp_no % 10 | ||
| | LOOKUP JOIN languages_lookup_non_unique_key ON language_code | ||
| | EVAL country = MV_SORT(country) | ||
| | KEEP emp_no, language_code, language_name, country | ||
| ; | ||
|
|
||
| emp_no:integer | language_code:integer | language_name:keyword | country:keyword | ||
| 10001 | 1 | [English, English, English] | [Canada, United Kingdom, United States of America] | ||
| 10002 | 2 | [German, German, German] | [Austria, Germany, Switzerland] | ||
| 10003 | 3 | null | null | ||
| 10004 | 4 | Quenya | null | ||
| 10005 | 5 | null | Atlantis | ||
| ; | ||
|
|
||
| nonUniqueRightKeyFromRow | ||
| required_capability: join_lookup_v5 | ||
|
|
||
| ROW language_code = 2 | ||
| | LOOKUP JOIN languages_lookup_non_unique_key ON language_code | ||
| | DROP country.keyword | ||
| | EVAL country = MV_SORT(country) | ||
| ; | ||
|
|
||
| language_code:integer | language_name:keyword | country:keyword | ||
| 2 | [German, German, German] | [Austria, Germany, Switzerland] | ||
| ; | ||
|
|
||
| lookupIPFromRow | ||
| required_capability: join_lookup_v5 | ||
|
|
||
|
|
||
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.
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.
Adding some intentional denormalization ("dirty data") to show how we're collecting nulls and mvs.