kosiew commented on code in PR #15589:
URL: https://github.com/apache/datafusion/pull/15589#discussion_r2030914487


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -2152,6 +2169,17 @@ mod tests {
         }
     }
 
+    #[test]
+    fn test_simplify_eq_not_self() {
+        let expr_a = col("c2").eq(col("c2"));
+        let expr_b = col("c2_non_null").eq(col("c2_non_null"));
+        let expected_a = col("c2").is_not_null().or(lit_bool_null());
+        let expected_b = lit(true);

Review Comment:
   ```suggestion
       // `expr_a`: column `c2` is nullable, so `c2 = c2` simplifies to `c2 IS 
NOT NULL OR NULL`
       // This ensures the expression is only true when `c2` is not NULL, 
accounting for SQL's NULL semantics.
       let expected_a = col("c2").is_not_null().or(lit_bool_null());
   
       // `expr_b`: column `c2_non_null` is explicitly non-nullable, so 
`c2_non_null = c2_non_null` is always true
       let expected_b = lit(true);
   ```
   
   



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to