Repository navigation
Fix the return dtype of grouped is_sorted and is_constant - #11238
Merged
Merged
Conversation
`GroupedAccumulator<IsSorted>::finish` failed with "Return DType mismatch". `IsSorted::finalize` read `is_sorted` out of the nullable partial struct, so it returned `Bool?` instead of the non-nullable `Bool` return dtype. Empty and null groups leave a null partial, which is the empty state. Grouped `is_sorted` now returns `true` for these groups, the same verdict that `finalize_scalar` gives the empty state. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
`GroupedAccumulator<IsConstant>::finish` failed with "Return DType mismatch". `IsConstant::finalize` read `is_constant` out of the nullable partial struct, so it returned `Bool?` instead of the non-nullable `Bool` return dtype. Empty and null groups leave a null partial, which is the empty state. Grouped `is_constant` now returns `false` for these groups, the same verdict that `finalize_scalar` gives the empty state. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Merging this PR will improve performance by 22.47%1 warning
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
robert3005
approved these changes
Nov 4, 2026
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
Every grouped
is_sortedandis_constantcall fails with "Return DType mismatch". Bothfinalizemethods read the result field out of the nullable partial struct, which givesBool?while the return dtype is a non-nullableBool. #11188 found theis_sortedcase, and its grouped pushdown test covers onlymin_maxbecause of it.Changes
Both
finalizemethods now fill null partials. A null partial comes from an empty or null group and is the empty state, so each fill uses the verdict thatfinalize_scalaralready gives that state:trueforis_sorted(vacuously sorted) andfalseforis_constant. Grouped and scalar results now agree. Note that a null group gets the same verdict as an empty group, since the partial can't tell them apart and the return dtype is non-nullable.Each aggregate gets a grouped test that puts empty, all-null, and null groups next to ordinary ones.