github-actions[bot] commented on code in PR #64696:
URL: https://github.com/apache/doris/pull/64696#discussion_r3459281459
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -939,6 +942,22 @@ public Expression visitBetween(Between between,
ExpressionRewriteContext context
}
}
+ @Override
+ public Expression visitIsTrue(IsTrue isTrue, ExpressionRewriteContext
context) {
+ Expression child = isTrue.child().accept(this, context);
+ return new And(
Review Comment:
This lowering still is not equivalent to a two-valued `IS` predicate. Doris'
varchar-to-boolean cast returns NULL for non-NULL strings such as `"abc"`, so
`SELECT 'abc' IS NOT TRUE` becomes `NOT(CAST('abc' AS BOOLEAN) AND NOT('abc' IS
NULL))`; the inner `AND` is NULL and the outer `NOT` stays NULL, even though
the new `IsTrue`/`IsFalse` nodes are declared `AlwaysNotNullable`. It also
evaluates `child` twice because the same expression is placed under both `CAST`
and `IS NULL`; an observable example is `sleep(1) IS FALSE`, where FE does not
mark `sleep` volatile and BE actually sleeps for each evaluation. Please lower
through a single, null-safe boolean result (or keep a first-class operator
until execution) and add regression coverage for non-boolean operands that cast
to true, false, NULL, and SQL NULL, including the `IS NOT` forms.
##########
regression-test/data/query_p0/sql_functions/test_is_true_false_predicate.out:
##########
@@ -0,0 +1,20 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !is_true --
+1
+
+-- !is_false --
+2
+
+-- !is_not_true --
+2
+3
+
+-- !is_not_false --
+1
+3
+
+-- !truth_table --
+1 true false false true
+2 false true true false
+3 false false true true
+
Review Comment:
`git diff --check` fails on this new output file:
`regression-test/data/query_p0/sql_functions/test_is_true_false_predicate.out:20:
new blank line at EOF.` Please regenerate or trim the `.out` file so it ends
at the last expected result row.
--
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]