What is the bug?
When using isnotnull() with certain conditions, it won't be pushed down
How can one reproduce the bug?
Steps to reproduce the behavior:
- Run
POST /testindex/_doc
{
"a": "1"
}
POST /testindex/_doc
{
"a": "2"
}
POST /testindex/_doc
{
"a": null,
"b": "1"
}
POST /_plugins/_ppl
{
"query": "source = testindex | where a != '1' and a != '2' and isnotnull(a)"
}- See query result includes doc where
a is null
{
"schema": [
{
"name": "a",
"type": "string"
},
{
"name": "b",
"type": "string"
}
],
"datarows": [
[
null,
"1"
]
],
"total": 1,
"size": 1
}What is the expected behavior?
isnotnull() should always filter out null values
What is your host/environment?
- OS: [e.g. iOS] linux
- Version [e.g. 22] 2.19
- Plugins all
Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
Do you have any additional context?
explain
// source = testindex | where a != '1' and isnotnull(a){"calcite": {"logical": """LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])
LogicalProject(a=[$0],b=[$1])LogicalFilter(condition=[<>($0, '1')])
CalciteLogicalIndexScan(table=[[OpenSearch, testindex]])
""",
"physical": """CalciteEnumerableIndexScan(table=[[OpenSearch, testindex]], PushDownContext=[[PROJECT->[a,b],FILTER-><>($0, '1'), LIMIT->10000],OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":10000,"timeout":"1m","query":{"bool":{"must":[{"exists":{"field":"a","boost":1.0}}],"must_not":[{"term":{"a.keyword":{"value":"1","boost":1.0}}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":["a","b"],"excludes":[]}},requestedTotalSize=10000,pageSize=null,startFrom=0)])
"""
}}{"from": 0,"size": 10000,"timeout": "1m","query": {"bool": {"must": [{"exists": {"field": "a","boost": 1.0}}],"must_not": [{"term": {"a.keyword": {"value": "1","boost": 1.0}}}],"adjust_pure_negative": true,"boost": 1.0}},"_source": {"includes": ["a","b"],"excludes": []}}// source = testindex | where a != '1' and a != '2' and isnotnull(a){"calcite": {"logical": """LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])
LogicalProject(a=[$0],b=[$1])LogicalFilter(condition=[SEARCH($0,Sarg[(-∞..'1'),('1'..'2'),('2'..+∞);NULLASFALSE]:CHAR(1))])CalciteLogicalIndexScan(table=[[OpenSearch,testindex]])
""","physical": """CalciteEnumerableIndexScan(table=[[OpenSearch, testindex]], PushDownContext=[[PROJECT->[a, b], FILTER->SEARCH($0, Sarg[(-∞..'1'), ('1'..'2'), ('2'..+∞); NULL AS FALSE]:CHAR(1)), LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":10000,"timeout":"1m","query":{"bool":{"must_not":[{"terms":{"a.keyword":["1","2"],"boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":["a","b"],"excludes":[]}}, requestedTotalSize=10000, pageSize=null, startFrom=0)])"""}}{"from": 0,"size": 10000,"timeout": "1m","query": {"bool": {"must_not": [{"terms": {"a.keyword": ["1","2"],"boost": 1.0}}],"adjust_pure_negative": true,"boost": 1.0}},"_source": {"includes": ["a","b"],"excludes": []}}
What is the bug?
When using
isnotnull()with certain conditions, it won't be pushed downHow can one reproduce the bug?
Steps to reproduce the behavior:
ais null{ "schema": [ { "name": "a", "type": "string" }, { "name": "b", "type": "string" } ], "datarows": [ [ null, "1" ] ], "total": 1, "size": 1 }What is the expected behavior?
isnotnull()should always filter out null valuesWhat is your host/environment?
Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
Do you have any additional context?
explain