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

   ## Which issue does this PR close?
   
   - Closes #26689.
   
   ## Rationale for this change
   
   `GROUPS BETWEEN CURRENT ROW AND CURRENT ROW` and bounded `rank` / 
`dense_rank` split peers that should be equal when the order key is a nested 
dictionary whose nulls are encoded two different ways (null dictionary key vs 
key that maps to a null value). The RANGE path already treats those as the same 
peer via a lexicographical comparator; GROUPS and the bounded rank evaluator 
still used `PartialEq` / `ScalarValue::try_cmp`, which look at storage rather 
than logical value, so you get `count = 1,1` and `rank = 1,2` instead of `2,2` 
and `1,1`.
   
   ## What changes are included in this PR?
   
   - `WindowFrameStateGroups` now builds the same nested 
`LexicographicalComparator` used for RANGE when deciding group boundaries.
   - Bounded `rank` / `dense_rank` compare the previous and current order keys 
with that lexicographical peer check instead of `ScalarValue` equality alone.
   - Unit tests for both paths, plus SessionContext integration tests that 
match the repro in #26689.
   
   ## What is the testing strategy for this PR?
   
   - `datafusion-expr` unit test 
`groups_peers_compare_nested_dictionary_nulls_logically` (and the existing 
GROUPS boundary tests).
   - `datafusion-functions-window` unit test 
`nested_dictionary_null_peers_share_rank`.
   - `core_integration` tests in `window_nested_groups_rank.rs` for GROUPS 
`count(*)` and bounded `rank` / `dense_rank` with `target_partitions = 1`.
   
   ## Are there any user-facing changes?
   
   Bug fix only: nested dictionary null peers now stay together for GROUPS 
frames and bounded ranking. No public API change.
   
   ## AI assistance
   
   AI tooling helped draft the patch and tests; I reviewed the logic against 
#26689 and the existing RANGE peer comparator, and ran the tests listed above.
   


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