-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Initial support for TEXT fields in LOOKUP JOIN condition #119473
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 16 commits
a4f3b5e
c1744c9
8eb6554
69572e5
417d3df
e799ef9
772659d
93779f9
cbcd532
0146742
e327808
77fc5bf
2b2f0dc
4380656
6a56279
3491006
d5d7cee
879ecd4
724153c
863cfc9
26a76f9
f0ce28a
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,133 @@ | ||
| --- | ||
| setup: | ||
| - requires: | ||
| test_runner_features: [capabilities, contains] | ||
| capabilities: | ||
| - method: POST | ||
| path: /_query | ||
| parameters: [] | ||
| capabilities: [lookup_join_text] | ||
|
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. Uh, I missed it, but this should also declare 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. Opened a pr for it #120771 |
||
| reason: "uses LOOKUP JOIN" | ||
| - do: | ||
| indices.create: | ||
| index: test | ||
| body: | ||
| mappings: | ||
| properties: | ||
| color: | ||
| type: text | ||
| fields: | ||
| keyword: | ||
| type: keyword | ||
| description: | ||
| type: text | ||
| fields: | ||
| keyword: | ||
| type: keyword | ||
| - do: | ||
| indices.create: | ||
| index: test-lookup | ||
| body: | ||
| settings: | ||
| index: | ||
| mode: lookup | ||
| number_of_shards: 1 | ||
| mappings: | ||
| properties: | ||
| color: | ||
| type: text | ||
| fields: | ||
| keyword: | ||
| type: keyword | ||
| description: | ||
| type: text | ||
| fields: | ||
| keyword: | ||
| type: keyword | ||
| - do: | ||
| bulk: | ||
| index: "test" | ||
| refresh: true | ||
| body: | ||
| - { "index": { } } | ||
| - { "color": "red", "description": "The color Red" } | ||
| - { "index": { } } | ||
| - { "color": "blue", "description": "The color Blue" } | ||
| - { "index": { } } | ||
| - { "color": "green", "description": "The color Green" } | ||
| - do: | ||
| bulk: | ||
| index: "test-lookup" | ||
| refresh: true | ||
| body: | ||
| - { "index": { } } | ||
| - { "color": "red", "description": "As red as a tomato" } | ||
| - { "index": { } } | ||
| - { "color": "blue", "description": "As blue as the sky" } | ||
|
|
||
| --- | ||
| keyword-keyword: | ||
| - do: | ||
| esql.query: | ||
| body: | ||
| query: 'FROM test | SORT color | LOOKUP JOIN `test-lookup` ON color.keyword | LIMIT 3' | ||
|
|
||
| - length: { columns: 4 } | ||
| - length: { values: 3 } | ||
| - match: {columns.0.name: "color.keyword"} | ||
| - match: {columns.0.type: "keyword"} | ||
| - match: {columns.1.name: "color"} | ||
| - match: {columns.1.type: "text"} | ||
| - match: {columns.2.name: "description"} | ||
| - match: {columns.2.type: "text"} | ||
| - match: {columns.3.name: "description.keyword"} | ||
| - match: {columns.3.type: "keyword"} | ||
| - match: {values.0: ["blue", "blue", "As blue as the sky", "As blue as the sky"]} | ||
| - match: {values.1: ["green", null, null, null]} | ||
| - match: {values.2: ["red", "red", "As red as a tomato", "As red as a tomato"]} | ||
|
|
||
| --- | ||
| text-keyword: | ||
| - do: | ||
| esql.query: | ||
| body: | ||
| query: 'FROM test | SORT color | RENAME color AS x | EVAL color.keyword = x | LOOKUP JOIN `test-lookup` ON color.keyword | LIMIT 3' | ||
|
|
||
| - length: { columns: 5 } | ||
| - length: { values: 3 } | ||
| - match: {columns.0.name: "x"} | ||
| - match: {columns.0.type: "text"} | ||
| - match: {columns.1.name: "color.keyword"} | ||
| - match: {columns.1.type: "text"} | ||
| - match: {columns.2.name: "color"} | ||
| - match: {columns.2.type: "text"} | ||
| - match: {columns.3.name: "description"} | ||
| - match: {columns.3.type: "text"} | ||
| - match: {columns.4.name: "description.keyword"} | ||
| - match: {columns.4.type: "keyword"} | ||
| - match: {values.0: ["blue", "blue", "blue", "As blue as the sky", "As blue as the sky"]} | ||
| - match: {values.1: ["green", "green", null, null, null]} | ||
| - match: {values.2: ["red", "red", "red", "As red as a tomato", "As red as a tomato"]} | ||
|
|
||
| --- | ||
| text-text: | ||
| - do: | ||
| esql.query: | ||
| body: | ||
| query: 'FROM test | SORT color | LOOKUP JOIN `test-lookup` ON color | LIMIT 3' | ||
| catch: "bad_request" | ||
|
|
||
| - match: { error.type: "verification_exception" } | ||
| - contains: { error.reason: "Found 1 problem\nline 1:55: JOIN left field [color] of type [TEXT] is incompatible with right field [color] of type [TEXT]" } | ||
|
||
|
|
||
| --- | ||
| keyword-text: | ||
| - do: | ||
| esql.query: | ||
| body: | ||
| query: 'FROM test | SORT color | EVAL color = color.keyword | LOOKUP JOIN `test-lookup` ON color | LIMIT 3' | ||
| catch: "bad_request" | ||
|
|
||
| - match: { error.type: "verification_exception" } | ||
| - contains: { error.reason: "Found 1 problem\nline 1:84: JOIN left field [color] of type [KEYWORD] is incompatible with right field [color] of type [TEXT]" } | ||
|
|
||
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.
I suggest treating the
TEXTdata type on the hand right side of the join as a separate situation with a separate error message. See my comment from 191_lookup_join_text.yml.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.
OK. Done.