Brijesh-Thakkar opened a new pull request, #19587:
URL: https://github.com/apache/datafusion/pull/19587

   ## Which issue does this PR close?
   
   - Closes #19579
   
   ## Rationale for this change
   
   `ScalarValue::partial_cmp` previously returned a concrete ordering when NULL
   values were involved (e.g. comparing a non-NULL value with NULL, or NULL with
   NULL). This behavior was unexpected and inconsistent with SQL three-valued
   logic, where NULL values are not comparable.
   
   The incorrect ordering could propagate to higher-level utilities such as
   `try_cmp` and vector ordering, leading to subtle and hard-to-detect bugs.
   
   ## What changes are included in this PR?
   
   - Updated `ScalarValue::partial_cmp` to return `None` whenever either operand
     is NULL
   - Ensured `ScalarValue::try_cmp` returns an error for NULL comparisons
   - Aligned vector ordering utilities to behave consistently with the updated
     NULL comparison semantics
   - Added tests to validate the corrected behavior
   
   ## Are these changes tested?
   
   Yes.
   
   - Added a new unit test covering NULL comparison behavior in
     `ScalarValue::partial_cmp`
   - All existing unit tests and doctests pass
   
   ## Are there any user-facing changes?
   
   Yes.
   
   Comparisons involving NULL `ScalarValue`s no longer produce an ordering and 
now
   behave consistently with SQL semantics. This may affect users relying on the
   previous (incorrect) ordering behavior.
   


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