-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
For partial_cmp() function for ScalarValue
| impl PartialOrd for ScalarValue { |
The current behavior is unexpected:
// 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:
- Fix this behavior to follow SQL’s null comparison semantics, or
- 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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working