The two queries should return the same result, since in both cases the WHERE condition evaluates to FALSE for all the records.
The only difference is that the first query evaluates the condition on the data, while the second one evaluates it locally (name = 'doesNotExist', that could still be true vs. 'xyz' = 'doesNotExist', that is always false).
This issue could be related to #74064
Steps to reproduce
POST localhost:9200/_bulk
{"index": {"_index":"person"}}
{"name" : "foo", "surname":"bar"}
{"index": {"_index":"person"}}
{"name" : "foo", "surname":"baz"}
GET localhost:9200/_sql
{
"query":"select count(*), 'x' c from person where name = 'doesNotExist' group by c"
}
GET localhost:9200/_sql
{
"query":"select count(*), 'x' c from person where 'xyz' = 'doesNotExist' group by c"
}
returns one row
While
returns zero rows
The two queries should return the same result, since in both cases the WHERE condition evaluates to FALSE for all the records. The only difference is that the first query evaluates the condition on the data, while the second one evaluates it locally (
name = 'doesNotExist'
, that could still be true vs.'xyz' = 'doesNotExist'
, that is always false).This issue could be related to #74064
Steps to reproduce