2010YOUY01 opened a new issue, #19579: URL: https://github.com/apache/datafusion/issues/19579
### Describe the bug For `partial_cmp()` function for `ScalarValue` https://github.com/apache/datafusion/blob/79f67b8ef2d3016c866ae92d7d2f56d1a7830045/datafusion/common/src/scalar/mod.rs#L568 The current behavior is unexpected: ```rust // this test can be added to the above file that `partial_cmp()` lives #[test] fn scalar_partial_ordering_nulls() { use ScalarValue::*; assert_eq!( Int32(Some(3)).partial_cmp(&Int32(None)), Some(Ordering::Greater) ); assert_eq!( Int32(None).partial_cmp(&Int32(Some(3))), Some(Ordering::Less) ); } ``` The comparison between `ScalarValue { type: Int32, val: 3 }` and `ScalarValue { type: Int32, val: Null }` returns `Some(_)`, whereas I expected `None`, indicating that the values are not comparable, consistent with SQL’s three-valued logic. Additionally, comparing `Null` with `Null` returns `Some(Ordering::Equal)` instead of `None`. We should either: 1. Fix this behavior to follow SQL’s null comparison semantics, or 2. If this non-standard null behavior is intentional for specific reasons, explicitly document it in the comments. ### To Reproduce _No response_ ### Expected behavior _No response_ ### Additional context _No response_ -- 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]
