evangelisilva opened a new pull request, #20138:
URL: https://github.com/apache/datafusion/pull/20138

   ## Which issue does this PR close?
   Closes #19264.
   ## Rationale for this change
   The `analyze` function in `physical-expr` was incorrectly returning `None` 
(implying an empty set/infeasibility) when analyzing `NOT(Eq)` expressions 
(e.g., `NOT(a = 0.0)`).
   This was caused by `propagate_comparison` in `cp_solver.rs` returning 
`Ok(None)` for `Operator::Eq` when the parent interval is `FALSE`. `Ok(None)` 
in `cp_solver` is interpreted as "Infeasible", but `NOT(a=b)` is a feasible 
condition (it effectively creates two disjoint intervals, which the current 
`Interval` implementation cannot represent as a single interval, but it is 
certainly not empty).
   ## What changes are included in this PR?
   - Modified `propagate_comparison` in `cp_solver.rs`. When handling 
`Operator::Eq` with a `FALSE` parent (meaning we are looking for "Not Equal"), 
it now returns the original intervals (identity) instead of `None`. This treats 
the constraint as valid/feasible but properly reflects that we cannot refine 
the bounds further with single-interval arithmetic.
   - Added a new regression test `analyze_not_eq_around` in 
`datafusion/physical-expr/src/analysis.rs` to verify that `NOT(a = 0.0)` now 
returns a valid interval encompassing the domain instead of `None`.
   ## Are these changes tested?
   Yes, tested locally.
   - Run command: `cargo test -p datafusion-physical-expr --lib analysis::tests`
   - Verification: The new test `analyze_not_eq_around` passes, and existing 
tests in `analysis.rs` also pass.
   ## Are there any user-facing changes?
   No, this is a bug fix in the physical expression analysis logic.


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