Fix NaN-aware top/bottom N parity across engines#861
Merged
polakowo merged 1 commit intoJul 3, 2026
Conversation
Align top_n/bottom_n selection semantics for NaN-containing mapped arrays across engines while preserving deterministic tie order and non-NaN behavior. Add targeted regression and parity tests for NaN cases, overflow selection, and tie-order determinism. Co-authored-by: Cursor <cursoragent@cursor.com>
Owner
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
top_n/bottom_nNaN-aware inrecords.nbwithout dtype promotion, preserving deterministic tie order for non-NaN datatop_n_mapped_mask/bottom_n_mapped_masksemantics with Numba for NaN-containing columns (includingn > n_validand all-NaN cases)Backward compatibility
Test plan
uv run --python 3.11 --extra test pytest tests/test_records.py -k "top_bottom_n_mask_with_nan or top_bottom_n_mask_with_all_nan_column or top_bottom_n_mask_tie_order"uv run --python 3.11 --extra test pytest tests/test_engine.py -k "top_n_mapped_mask_nan or bottom_n_mapped_mask_nan or top_bottom_n_mapped_mask_nan_overflow"(Rust-gated tests skip when rust package is unavailable)uv run --python 3.11 --extra test pytestCo-authored by Cursor