jayzhan211 commented on PR #27347:
URL: https://github.com/apache/datafusion/pull/27347#issuecomment-6873043655

   @galaxytemple yes, please open one. `exprs_equal` never compares the 
operator, so `exprs_equal(a + 5, a % 5)` returns `true` even with an empty 
equivalence group. After this PR, union no longer calls it; the only caller 
left on main is the range-partitioning check 
`range_transform_proves_key_locality` in `partitioning.rs`, so the issue can 
start from this test.
   
   <details>
   <summary>Unit test showing the wrong result (in the `equivalence::class` 
tests)</summary>
   
   ```rs
   #[test]
   fn exprs_equal_ignores_operator() {
       let schema = Schema::new(vec![Field::new("a", DataType::Int32, false)]);
       let a = col("a", &schema).unwrap();
       let plus: Arc<dyn PhysicalExpr> =
           Arc::new(BinaryExpr::new(Arc::clone(&a), Operator::Plus, lit(5i32)));
       let modulo: Arc<dyn PhysicalExpr> =
           Arc::new(BinaryExpr::new(a, Operator::Modulo, lit(5i32)));
       // currently true
       assert!(!EquivalenceGroup::default().exprs_equal(&plus, &modulo));
   }
   ```
   </details>
   


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