1fanwang commented on code in PR #23615:
URL: https://github.com/apache/datafusion/pull/23615#discussion_r3760669481


##########
datafusion/optimizer/src/simplify_expressions/utils.rs:
##########
@@ -26,13 +27,18 @@ use datafusion_expr::{
 
 /// returns true if `needle` is found in a chain of search_op
 /// expressions. Such as: (A AND B) AND C
+///
+/// Equality uses [`NormalizeEq`] so commutative operands (`A = B` vs `B = A`)
+/// are recognized as the same predicate even when the canonicalizer is
+/// disabled, notably for `LogicalPlan::Join` filters (see
+/// <https://github.com/apache/datafusion/pull/8780>).
 fn expr_contains_inner(expr: &Expr, needle: &Expr, search_op: Operator) -> 
bool {
     match expr {
         Expr::BinaryExpr(BinaryExpr { left, op, right }) if *op == search_op 
=> {
             expr_contains_inner(left, needle, search_op)
                 || expr_contains_inner(right, needle, search_op)
         }
-        _ => expr == needle,
+        _ => expr.normalize_eq(needle),

Review Comment:
   Good catch — fixed in 5113377ee



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