-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Allow remote enrich after LOOKUP JOIN #131940
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 25 commits
5c6b3f4
3aaf1b4
4efe247
0f65dd5
6d52153
db33e26
cd57460
f0c3d53
f488b7d
75f0210
627ea94
8fa80a9
378fc00
54245d9
39caa37
cdebea5
66e7767
9d40e10
95baad7
59e02b4
baaeec6
842c659
27ff9ae
f9efe24
516c5ee
20cbdfe
f53a301
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,5 @@ | ||
| pr: 131940 | ||
| summary: Allow remote enrich after LOOKUP JOIN | ||
| area: ES|QL | ||
| type: enhancement | ||
| issues: [] |
|
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. Test case suggestion:
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1875,6 +1875,76 @@ type:keyword | language_code:integer | language_name:keyword | |
| Production | 3 | Spanish | ||
| ; | ||
|
|
||
| enrichAfterLookupJoin | ||
| required_capability: join_lookup_v12 | ||
|
|
||
| FROM sample_data | ||
| | KEEP message | ||
| | WHERE message == "Connected to 10.1.0.1" | ||
| | EVAL language_code = "1" | ||
| | LOOKUP JOIN message_types_lookup ON message | ||
| | ENRICH languages_policy ON language_code | ||
| ; | ||
|
|
||
| message:keyword | language_code:keyword | type:keyword | language_name:keyword | ||
| Connected to 10.1.0.1 | 1 | Success | English | ||
| ; | ||
|
|
||
| remoteEnrichAfterLookupJoin | ||
| required_capability: join_lookup_v12 | ||
| required_capability: remote_enrich_after_lookup_join | ||
|
|
||
| # TODO: a bunch more tests, also switch orders, use double _remote enrich, double lookup join etc. Also add tests with | ||
| # _coordinator enrich. What about ROW? | ||
|
|
||
| FROM sample_data | ||
| | KEEP message | ||
| | WHERE message == "Connected to 10.1.0.1" | ||
| | EVAL language_code = "1" | ||
| | LOOKUP JOIN message_types_lookup ON message | ||
| | ENRICH _remote:languages_policy ON language_code | ||
| ; | ||
|
|
||
| message:keyword | language_code:keyword | type:keyword | language_name:keyword | ||
| Connected to 10.1.0.1 | 1 | Success | English | ||
| ; | ||
|
|
||
| remoteEnrichSortAfterLookupJoin | ||
| required_capability: join_lookup_v12 | ||
| required_capability: remote_enrich_after_lookup_join | ||
|
|
||
| FROM sample_data | ||
| | KEEP message | ||
| | WHERE message == "Connected to 10.1.0.1" OR message == "Connected to 10.1.0.2" | ||
| | EVAL language_code = "1" | ||
| | LOOKUP JOIN message_types_lookup ON message | ||
| | ENRICH _remote:languages_policy ON language_code | ||
| | SORT message ASC | ||
| ; | ||
|
|
||
| message:keyword | language_code:keyword | type:keyword | language_name:keyword | ||
| Connected to 10.1.0.1 | 1 | Success | English | ||
| Connected to 10.1.0.2 | 1 | Success | English | ||
| ; | ||
|
|
||
| sortRemoteEnrichAfterLookupJoin | ||
| required_capability: join_lookup_v12 | ||
| required_capability: remote_enrich_after_lookup_join | ||
|
|
||
| FROM sample_data | ||
| | KEEP message | ||
| | WHERE message == "Connected to 10.1.0.1" OR message == "Connected to 10.1.0.2" | ||
| | EVAL language_code = "1" | ||
| | LOOKUP JOIN message_types_lookup ON message | ||
| | SORT message ASC | ||
|
||
| | ENRICH _remote:languages_policy ON language_code | ||
| | LIMIT 2 | ||
| ; | ||
|
|
||
| message:keyword | language_code:keyword | type:keyword | language_name:keyword | ||
| Connected to 10.1.0.1 | 1 | Success | English | ||
| Connected to 10.1.0.2 | 1 | Success | English | ||
| ; | ||
|
|
||
| ############################################### | ||
| # LOOKUP JOIN on mixed numerical fields | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -358,4 +358,74 @@ public void testRemoteLookupJoinWithPipelineBreaker() { | |
| // Since FORK, RERANK, COMPLETION and CHANGE_POINT are not supported on remote indices, we can't check them here against the remote | ||
| // LOOKUP JOIN | ||
| } | ||
|
|
||
| public void testRemoteEnrichAfterLookupJoinWithPipelineBreaker() { | ||
|
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. These tests don't rely on post-optimization verification, right? Maybe it'd be a bit more fitting to have them be part of the VerifierTests. 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. Yes, these are from 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. No wait I'm wrong, only |
||
| EnrichResolution enrichResolution = new EnrichResolution(); | ||
| loadEnrichPolicyResolution( | ||
| enrichResolution, | ||
| Enrich.Mode.REMOTE, | ||
| MATCH_TYPE, | ||
| "languages", | ||
| "language_code", | ||
| "languages_idx", | ||
| "mapping-languages.json" | ||
| ); | ||
| loadEnrichPolicyResolution( | ||
| enrichResolution, | ||
| Enrich.Mode.COORDINATOR, | ||
| MATCH_TYPE, | ||
| "languages_coord", | ||
| "language_code", | ||
| "languages_idx", | ||
| "mapping-languages.json" | ||
| ); | ||
| var analyzer = AnalyzerTestUtils.analyzer( | ||
| loadMapping("mapping-default.json", "test"), | ||
| defaultLookupResolution(), | ||
| enrichResolution, | ||
| TEST_VERIFIER | ||
| ); | ||
|
|
||
| String err = error(""" | ||
| FROM test | ||
| | STATS c = COUNT(*) by languages | ||
| | EVAL language_code = languages | ||
| | LOOKUP JOIN languages_lookup ON language_code | ||
| | ENRICH _remote:languages ON language_code | ||
| """, analyzer); | ||
| assertThat( | ||
| err, | ||
| containsString("4:3: LOOKUP JOIN with remote indices can't be executed after [STATS c = COUNT(*) by languages]@2:3") | ||
|
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. Welp, the error message may have to be improved in the future. But I know that'd require more effort as the validation for remote LJ requires it to be marked as remote already before optimization. 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. Yeah this is not the most obvious result here. Not sure how to make it better - technically the message is correct, but probably doesn't explain well what's going on. |
||
| ); | ||
|
|
||
| err = error(""" | ||
| FROM test | ||
| | SORT emp_no | ||
| | EVAL language_code = languages | ||
| | LOOKUP JOIN languages_lookup ON language_code | ||
| | ENRICH _remote:languages ON language_code | ||
| """, analyzer); | ||
| assertThat(err, containsString("4:3: LOOKUP JOIN with remote indices can't be executed after [SORT emp_no]@2:3")); | ||
|
|
||
| err = error(""" | ||
| FROM test | ||
| | LIMIT 2 | ||
| | EVAL language_code = languages | ||
| | LOOKUP JOIN languages_lookup ON language_code | ||
| | ENRICH _remote:languages ON language_code | ||
| """, analyzer); | ||
| assertThat(err, containsString("4:3: LOOKUP JOIN with remote indices can't be executed after [LIMIT 2]@2:3")); | ||
|
|
||
| err = error(""" | ||
| FROM test | ||
| | EVAL language_code = languages | ||
| | ENRICH _coordinator:languages_coord | ||
| | LOOKUP JOIN languages_lookup ON language_code | ||
| | ENRICH _remote:languages ON language_code | ||
| """, analyzer); | ||
| assertThat( | ||
| err, | ||
| containsString("4:3: LOOKUP JOIN with remote indices can't be executed after [ENRICH _coordinator:languages_coord]@3:3") | ||
| ); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.