elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.22k stars 24.85k forks source link

SQL: Wrong folding of `=` expression and `AND` #35859

Open matriv opened 5 years ago

matriv commented 5 years ago

SELECT languages = 10 AND languages = 11 FROM test_emp where emp_no IN(10018, 10019, 10020, 10021);

returns:

     false     
---------------
false          

as the AND expression is wrongly folded to false (can also be null) and on top it becomes a LocalRelation.

elasticmachine commented 5 years ago

Pinging @elastic/es-search

matriv commented 4 years ago

@elastic/es-ql

elasticsearchmachine commented 10 months ago

Pinging @elastic/es-analytical-engine (Team:Analytics)

bpintea commented 6 months ago

FWIW, this improved partially (null still not being covered), the query SELECT emp_no, languages, languages = 10 AND languages = 11 FROM employees where emp_no IN(10018, 10019, 10020, 10021) returns as of 8.14:

    emp_no     |   languages   |languages = 10 AND languages = 11
---------------+---------------+---------------------------------
10018          |2              |false                            
10019          |1              |false                            
10020          |null           |false                            
10021          |null           |false