Repository navigation
Commit 0576a0b
authored
fix: compare ScalarValue maps using Arrow ordering (#25555)
## Which issue does this PR close?
Close #25556
## Rationale for this change
`ScalarValue::partial_cmp` only compared Map keys and ignored their
values. Maps with identical keys but different values were therefore
considered equal.
This could produce incorrect ordering when merging ordered aggregate
states, such as `first_value`, `last_value`, and `nth_value`, and could
incorrectly validate range partition split points.
## What changes are included in this PR?
Use Arrow's Map comparator for `ScalarValue::Map` comparisons. This
aligns scalar comparison with Arrow sorting and nested comparison
semantics, including values, entry order, lengths, and nulls.
Add unit tests covering these cases.
## What is the testing strategy for this PR?
Added `test_map_partial_cmp` covering:
- maps with identical keys and different values
- lexicographic `(key, value)` entry ordering
- maps of different lengths
- null and empty maps
## Are there any user-facing changes?
Map scalar comparisons now consider both keys and values and are
consistent with Arrow ordering.1 parent 31a4ca0 commit 0576a0b
1 file changed
Lines changed: 41 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
920 | 920 | | |
921 | 921 | | |
922 | 922 | | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
940 | 928 | | |
941 | 929 | | |
942 | 930 | | |
| |||
7424 | 7412 | | |
7425 | 7413 | | |
7426 | 7414 | | |
| 7415 | + | |
| 7416 | + | |
| 7417 | + | |
| 7418 | + | |
| 7419 | + | |
| 7420 | + | |
| 7421 | + | |
| 7422 | + | |
| 7423 | + | |
| 7424 | + | |
| 7425 | + | |
| 7426 | + | |
| 7427 | + | |
| 7428 | + | |
| 7429 | + | |
| 7430 | + | |
| 7431 | + | |
| 7432 | + | |
| 7433 | + | |
| 7434 | + | |
| 7435 | + | |
| 7436 | + | |
| 7437 | + | |
| 7438 | + | |
| 7439 | + | |
| 7440 | + | |
| 7441 | + | |
| 7442 | + | |
| 7443 | + | |
| 7444 | + | |
| 7445 | + | |
| 7446 | + | |
| 7447 | + | |
| 7448 | + | |
| 7449 | + | |
7427 | 7450 | | |
7428 | 7451 | | |
7429 | 7452 | | |
| |||
0 commit comments