github-actions[bot] commented on code in PR #64696:
URL: https://github.com/apache/doris/pull/64696#discussion_r3464801474
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -939,6 +942,24 @@ public Expression visitBetween(Between between,
ExpressionRewriteContext context
}
}
+ @Override
+ public Expression visitIsTrue(IsTrue isTrue, ExpressionRewriteContext
context) {
+ Expression child = isTrue.child().accept(this, context);
+ if (!child.getDataType().isBooleanType()) {
+ child = new Cast(child, BooleanType.INSTANCE);
+ }
Review Comment:
This fixes the truth table, but the lowered expression no longer preserves
the non-nullability contract of `IS TRUE`/`IS FALSE`. Both methods replace the
`AlwaysNotNullable` predicate with an `And`, and `CompoundPredicate.nullable()`
becomes true whenever the cast/child can be nullable. That metadata is
observable: `Alias.toSlot()` copies `child().nullable()`, `createFinalCols()`
uses `output.nullable()` for view columns, and the translator copies
`slotReference.nullable()` into slot descriptors. For example, `CREATE VIEW v
AS SELECT b IS TRUE AS c FROM t` can record/report `c` as nullable even though
the predicate is two-valued. Please keep this as a non-nullable expression
through analysis/translation, or otherwise force the lowered result's
`nullable()` to false, and add coverage for nullable boolean and
cast-to-boolean operands.
--
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]