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

   ## Which issue does this PR close?
   
   - Closes #25097.
   
   ## Rationale for this change
   
   `RowValues::compare` ignores its `l_idx`/`r_idx` arguments and compares 
cached current-row slices. Correct today, but the narrowing of the 
`CursorValues` contract was unenforced — a future caller passing arbitrary 
indices would silently produce a wrong merge order.
   
   ## What changes are included in this PR?
   
   - Debug-only `current_offset` field on `RowValues`, recorded in 
`set_offset`, asserted against `l_idx`/`r_idx` in `compare`. Zero cost in 
release.
   - Impl-level docs stating the deliberately narrowed contract.
   - A `#[should_panic]` test covering the new assert.
   
   ## Are these changes tested?
   
   Yes — new debug-only test; existing `sorts::` tests (124) pass with the 
asserts active.
   
   ## Are there any user-facing changes?
   
   No.
   
   ## Possible later work
   
   - `ArrayValues` forwards arbitrary indices by design; if `RowValues` is ever 
wrapped similarly, a fallback to `rows.row(idx)` could restore the full trait 
contract (rejected here to keep the merge hot path branch-free).


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