Repository navigation
Fix #1140: Align the partial hierarchy modes on row labels in the pandas engine - #1143
Merged
Merged
Conversation
javihern98
approved these changes
Oct 13, 2026
javihern98
left a comment
Contributor
There was a problem hiding this comment.
Looks good, 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
With the pandas engine,
hierarchyinpartial_null/partial_zeromode crashed when a rule's right-side code items were missing for some values of the other identifiers:HAAssignmentused the operands' row labels as positions (iloc), which fails once the partial mask drops rows that are not the last ones. It now selects the rows by label.update_partial_datawidened the mask with|=, keeping only the index of the first code item. A code item computed by an earlier rule may miss some groups, so the mask now covers the union of both indexes, andvisit_HRBinOpfilters each operand by label.The pandas results now match the DuckDB engine. Added tests
GH_1140_1–GH_1140_4(both cases from the issue, in both partial modes).Checklist
ruff format,ruff check,mypy): mypy's 3 errors inModel/__init__.pyare already on1.9.X, not from this changepytest)Impact / Risk
hierarchyinpartial_nullandpartial_zeromodes no longer crashes when code items are missing for some identifier values.Notes
The DuckDB engine is unchanged.
Closes #1140