Skip to content

Fix #1140: Align the partial hierarchy modes on row labels in the pandas engine - #1143

Merged
albertohernandez1995 merged 1 commit into
1.9.Xfrom
cr-1140
Oct 13, 2026
Merged

albertohernandez1995 merged 1 commit into
1.9.Xfrom
cr-1140

Conversation

@albertohernandez1995

Copy link
Copy Markdown
Contributor

Summary

With the pandas engine, hierarchy in partial_null / partial_zero mode crashed when a rule's right-side code items were missing for some values of the other identifiers:

  • HAAssignment used 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_data widened 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, and visit_HRBinOp filters 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

  • Code quality checks pass (ruff format, ruff check, mypy): mypy's 3 errors in Model/__init__.py are already on 1.9.X, not from this change
  • Tests pass (pytest)
  • Documentation updated (if applicable)

Impact / Risk

  • Breaking changes? No. Only the pandas engine changes, and only in cases that used to raise an internal error.
  • Data/SDMX compatibility concerns? None.
  • Notes for release/changelog? pandas engine: hierarchy in partial_null and partial_zero modes no longer crashes when code items are missing for some identifier values.

Notes

The DuckDB engine is unchanged.


Closes #1140

@javihern98 javihern98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! 😊

@albertohernandez1995
albertohernandez1995 added this pull request to the merge queue Oct 13, 2026
Merged via the queue into 1.9.X with commit e79cb06 Oct 13, 2026
24 checks passed
@albertohernandez1995
albertohernandez1995 deleted the cr-1140 branch October 13, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pandas engine: hierarchy in partial_null and partial_zero modes crashes when a rule's code items are missing for some identifier values

2 participants