Skip to content

Commit b0ea3d4

Browse files
committed
Send source in Join serialization, and add tests
1 parent b2c11ad commit b0ea3d4

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/lookup-join.csv-spec

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,53 @@ emp_no:integer | language_code:integer | language_name:keyword
396396
10005 | [-2, 13] | null
397397
;
398398

399+
mvJoinKeyOnTheLookupIndexAfterStats
400+
required_capability: join_lookup_v12
401+
required_capability: join_lookup_skip_mv_warnings
402+
403+
FROM employees
404+
| WHERE 10003 < emp_no AND emp_no < 10008
405+
| EVAL language_code = emp_no % 10
406+
| STATS BY emp_no, language_code
407+
| LOOKUP JOIN languages_lookup_non_unique_key ON language_code
408+
| SORT emp_no, language_name
409+
| KEEP emp_no, language_code, language_name
410+
;
411+
412+
warning:Line 5:3: evaluation of [LOOKUP JOIN languages_lookup_non_unique_key ON language_code] failed, treating result as null. Only first 20 failures recorded.
413+
warning:Line 5:3: java.lang.IllegalArgumentException: LOOKUP JOIN encountered multi-value
414+
415+
emp_no:integer | language_code:integer | language_name:keyword
416+
10004 | 4 | Quenya
417+
10005 | 5 | null
418+
10006 | 6 | null
419+
10007 | 7 | null
420+
;
421+
422+
mvJoinKeyOnFromAfterStats
423+
required_capability: join_lookup_v12
424+
required_capability: join_lookup_skip_mv_warnings
425+
426+
FROM employees
427+
| WHERE emp_no < 10006
428+
| EVAL language_code = salary_change.int
429+
| STATS language_code = VALUES(language_code) BY emp_no
430+
| LOOKUP JOIN languages_lookup ON language_code
431+
| SORT emp_no
432+
| KEEP emp_no, language_code, language_name
433+
;
434+
435+
warning:Line 5:3: evaluation of [LOOKUP JOIN languages_lookup ON language_code] failed, treating result as null. Only first 20 failures recorded.
436+
warning:Line 5:3: java.lang.IllegalArgumentException: LOOKUP JOIN encountered multi-value
437+
438+
emp_no:integer | language_code:integer | language_name:keyword
439+
10001 | 1 | English
440+
10002 | [-7, 11] | null
441+
10003 | [12, 14] | null
442+
10004 | [0, 1, 3, 13] | null
443+
10005 | [-2, 13] | null
444+
;
445+
399446
mvJoinKeyFromRow
400447
required_capability: join_lookup_v12
401448
required_capability: join_lookup_skip_mv_warnings

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/join/Join.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Join(StreamInput in) throws IOException {
6363

6464
@Override
6565
public void writeTo(StreamOutput out) throws IOException {
66-
Source.EMPTY.writeTo(out);
66+
source().writeTo(out);
6767
out.writeNamedWriteable(left());
6868
out.writeNamedWriteable(right());
6969
config.writeTo(out);

0 commit comments

Comments
 (0)