Repository navigation
Description
What is the bug?
Analysis accepts a non-boolean operand to a logical operator or a where condition, and the query then fails in codegen or on the shard with a 500, instead of a 400 naming the type.
How can one reproduce the bug?
- Create the index and doc:
curl -s -X PUT localhost:9200/hdemo -H 'Content-Type: application/json' \
-d '{"mappings":{"properties":{"s":{"type":"keyword"},"n":{"type":"integer"},"d":{"type":"double"},"b":{"type":"boolean"},"ts":{"type":"date"}}}}' | jq .acknowledged
curl -s -X POST 'localhost:9200/hdemo/_doc?refresh=true' -H 'Content-Type: application/json' \
-d '{"s":"abc","n":7,"d":1.5,"b":true,"ts":"2026-01-02T03:04:05Z"}' | jq .result- Run any of these:
for q in 'eval x = not n | fields x' 'eval x = b and n | fields x' 'where b or n' 'where n' 'where s'; do
curl -s -X POST localhost:9200/_plugins/_ppl -H 'Content-Type: application/json' \
-d "{\"query\":\"source=hdemo | $q\"}" | jq -c --arg q "$q" '{q: $q, status, type: .error.type, error: .error.details[0:90]}'
done
# {"q":"eval x = not n | fields x","status":500,"type":"SQLException","error":"Line 22, Column 72: No applicable constructor/method found for actual parameters \"java.lan"}
# {"q":"eval x = b and n | fields x","status":500,"type":"SQLException","error":"Line 27, Column 76: Not a boolean expression"}
# {"q":"where b or n","status":500,"type":"RuntimeException","error":"Line 7, Column 86: Not a boolean expression"}
# {"q":"where n","status":500,"type":"RuntimeException","error":"java.sql.SQLException: exception while executing query: Failed to fetch data from the inde"}
# {"q":"where s","status":500,"type":"RuntimeException","error":"java.sql.SQLException: exception while executing query: Failed to fetch data from the inde"}The two where cases fail on the shard: all shards failed ... ClassCastException[class java.lang.Long cannot be cast to class java.lang.Boolean] (for n) and [class java.lang.String cannot be cast to class java.lang.Boolean] (for s).
3. With a literal on the other side, constant folding hides the error, and the query returns 200 with the wrong type:
curl -s -X POST localhost:9200/_plugins/_ppl -H 'Content-Type: application/json' \
-d '{"query":"source=hdemo | eval x = true and n | fields x"}' | jq -c '{schema, datarows}'
# {"schema":[{"name":"x","type":"int"}],"datarows":[[7]]}What is the expected behavior?
HTTP 400 naming the operand type, as other functions already return (e.g. upper(n) → UPPER function expects {[STRING]}, but got [INTEGER]).
What is your host/environment?
- mainline (3.10.0-SNAPSHOT, c7e2cea), single node. With
plugins.calcite.pushdown.enabled=false,where sstill 500s, as a codegenNot a boolean expression.
Do you have any screenshots?
N/A
Do you have any additional context?
- On an older build (main as of 2026-10-08),
where sreturned 400 with"type":"AssertionError"(Filter condition must have type BOOLEAN or NULL, got VARCHAR). That was already a leaked assertion rather than a real check, and on current main it's a 500. - Same family as [BUG] concat, concat_ws, locate, position and truncate return 500 on an argument type they do not support #5886 (wrong argument types reaching codegen for
concat/locate/…) and [BUG] replace, trendline and transpose return 500 on a field type they do not support #5885. A signature check onNOT/AND/ORand on the filter condition would cover all of these. - Found by a property-based type checker (hegel).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNot Started
Activity