Closed fang-xing-esql closed 2 weeks ago
Pinging @elastic/es-analytical-engine (Team:Analytics)
Nice find!
I wonder if this is really a bug though.
where author not in (\"Neal Stephenson\", \"Ray Bradbury\", null)
should be equivalent to
where not (author == \"Neal Stephenson\") and not (author == \"Ray Bradbury\") and not (author == null)
The problem is: author == null
is not the same as author is null
. author == null
is always null, because, I think, null
is conceptually missing info; so we cannot determine if the left hand side is equal to the right hand side.
For reference, where author ==null
and where author != null
always yield empty results, even if for some documents the author is null
(or not).
Maybe we should just add a note to the docs, as this is unexpected (but consistent)?
Nice find!
I wonder if this is really a bug though.
You are right! It is not difficult to be tricked by nulls. Let me do some more experiments and most likely this is as expected.
When there is null in the inlist, NOT IN may return empty/wrong resultset, instead of qualified results.
IN returns correct results without null.
IN returns correct results with null.
NOT IN returns correct results without null.
NOT IN returns empty/wrong result with null.