clintropolis commented on code in PR #15974:
URL: https://github.com/apache/druid/pull/15974#discussion_r1504694300
##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRexExecutor.java:
##########
@@ -83,7 +83,11 @@ public void reduce(
final RexNode literal;
if (sqlTypeName == SqlTypeName.BOOLEAN) {
- literal = rexBuilder.makeLiteral(exprResult.asBoolean(),
constExp.getType(), true);
+ if (exprResult.valueOrDefault() == null) {
Review Comment:
this code impacts things that the planner determines are constants, and it
was a bug that it was using `exprResult.asBoolean()` without checking if
`exprResult` was null. This means that there are a handful of things (not just
array_contains/array_overlap) where the function behaves differently if it is a
constant than if it was a non-constant executed against a real table, because
most of the functions in the real table would correctly return null, while as a
constant they would not. This was the case for array_contains/array_overlap,
evaluating a constant would return false, while evaluating a table would return
null, and how i caught this bug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]