-
Notifications
You must be signed in to change notification settings - Fork 25.2k
ESQL: Fix NULL
handling in IN
clause
#125832
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
ESQL: Fix NULL
handling in IN
clause
#125832
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Thanks for review @idegtiarenko! I believe you should manually ping buildkite for a CI test since this PR is submitted by an external contributor. |
buildkite test this |
I forgot to add a new capability for the csv test, now it has been included in 2fd4e60. |
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.
LGTM, added minor notes only. 🙏
required_capability: filter_in_converted_null | ||
FROM employees | ||
| WHERE emp_no in (10021, 10022, null::int) | ||
| KEEP emp_no, first_name, last_name |
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.
Could we add a trailing SORT on emp_no
? The results might get rearranged otherwise and fail the test.
In in = new In( | ||
EMPTY, | ||
new FieldAttribute(Source.EMPTY, "field", new EsField("suffix", DataType.KEYWORD, Map.of(), true)), | ||
Arrays.asList(ONE, new Literal(Source.EMPTY, null, DataType.INTEGER), THREE) |
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.
Could we randomise the data type here?
buildkite test this |
Thanks, @kanoshiou! |
This PR fixes elastic#119950 where an `IN` query includes `NULL` values with non-NULL `DataType` appearing within the query range. An expression is considered `NULL` when its `DataType` is `NULL` or it is a `Literal` with a value of `null`.
* ESQL: Allow the data type of `null` in filters (#118324) * Allow the data type of `null` in filters * ESQL: Fix `NULL` handling in `IN` clause (#125832) This PR fixes #119950 where an `IN` query includes `NULL` values with non-NULL `DataType` appearing within the query range. An expression is considered `NULL` when its `DataType` is `NULL` or it is a `Literal` with a value of `null`. * Revert formatting --------- Co-authored-by: kanoshiou <[email protected]>
This PR fixes #119950 where an
IN
query includesNULL
values with non-NULLDataType
appearing within the query range. An expression is consideredNULL
when itsDataType
isNULL
or it is aLiteral
with a value ofnull
.