emanuele-em commented on code in PR #26375:
URL: https://github.com/apache/datafusion/pull/26375#discussion_r4578321408


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -4152,11 +4144,22 @@ mod tests {
 
         assert_eq!(col("c2").get_type(&schema).unwrap(), DataType::Boolean);
 
-        // c2 != true -> !c2
-        assert_eq!(simplify(col("c2").not_eq(lit(true))), col("c2").not(),);
-
-        // c2 != false -> c2
-        assert_eq!(simplify(col("c2").not_eq(lit(false))), col("c2"),);
+        for name in ["c2", "c2_non_null"] {

Review Comment:
   Restored the original `simplify(...)` assertions unchanged in c4f2692e3, and 
kept the new `simplify_no_canonicalize` loops alongside them, so the diff in 
the tests is now purely additive. Thanks @alamb and @jayzhan211.



##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -835,6 +835,20 @@ impl<'a> Simplifier<'a> {
     }
 }
 
+/// Simplifies `expr {=, !=} literal` in either operand order after checking
+/// that both operands have boolean type.
+fn simplify_boolean_comparison(
+    literal: &Expr,
+    other: Box<Expr>,
+    op: Operator,
+) -> Result<Expr> {
+    Ok(match (as_bool_lit(literal)?, op) {

Review Comment:
   Done in c4f2692e3: the four cases are now listed explicitly and any other 
operator returns an internal error. Agreed it reads closer to the old rule 
table.



##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -835,6 +835,20 @@ impl<'a> Simplifier<'a> {
     }
 }
 
+/// Simplifies `expr {=, !=} literal` in either operand order after checking

Review Comment:
   Reworded in c4f2692e3, thanks.



-- 
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]

Reply via email to