Skip to content

fix: make inherited fields accessible#1589

Merged
ianna merged 9 commits intomainfrom
ariostas/fix_rntuple_inheritance
Mar 12, 2026
Merged

fix: make inherited fields accessible#1589
ianna merged 9 commits intomainfrom
ariostas/fix_rntuple_inheritance

Conversation

@ariostas
Copy link
Member

@ariostas ariostas commented Mar 3, 2026

When a class inherits fields from a parent class, they are put into a :_0 field, which used to be fully ignored. Instead, I made those anonymous, so that they are transparent and reveal their subfields.

@ariostas
Copy link
Member Author

ariostas commented Mar 3, 2026

I had to switch to treating the subfields of variants differently instead of just considering them anonymous. But I think it should be good now. I'll add a test for this.

@ariostas ariostas marked this pull request as ready for review March 4, 2026 19:44
mrzimu and others added 2 commits March 11, 2026 15:13
… inheritance (#1594)

* fix: resolve duplicated field names in RNTuple by adding prefixes for inheritance

* fix: enhance unique field name generation in RNTuple by refining prefix handling

* remove type annotations

* add protection in name-generation loop

* invalidate sub-fields' path cache

* remove not-needed `record_names=None`

* Recursively invalidate path cache

Co-authored-by: Andres Rios Tascon <ariostas@gmail.com>

---------

Co-authored-by: Andres Rios Tascon <ariostas@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Uproot’s RNTuple field handling so that inherited fields stored under ROOT’s :_0 hierarchy fields become transparently accessible, and adds coverage for class inheritance schemas.

Changes:

  • Add a regression test covering single- and multi-inheritance RNTuple schemas and expected exposed field names.
  • Treat hierarchy encoding fields (:_[0-9]+) as anonymous (transparent) rather than ignored, while keeping variant-descendants hidden via a new in_variant flag.
  • Add a path-collision renaming step in RNTuple.all_fields to disambiguate duplicate field names by prefixing with ancestry (e.g. Child::base_a1).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
tests/test_1589_rntuple_inheritance.py New test validating exposed keys/fields and data for inherited members.
src/uproot/models/RNTuple.py Implements duplicate-path renaming, updates record form building, and refactors anonymous/variant handling (in_variant).
src/uproot/behaviors/RNTuple.py Makes anonymous hierarchy fields transparent in .fields, and hides variant-descendants via in_variant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

ariostas and others added 3 commits March 11, 2026 15:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@ianna ianna left a comment

Choose a reason for hiding this comment

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

@ariostas - Looks great! Thanks.

@ianna ianna merged commit d0fb5b9 into main Mar 12, 2026
28 checks passed
@ianna ianna deleted the ariostas/fix_rntuple_inheritance branch March 12, 2026 18:42
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.

4 participants