Merged
Conversation
Member
Author
|
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. |
… 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>
Contributor
There was a problem hiding this comment.
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 newin_variantflag. - Add a path-collision renaming step in
RNTuple.all_fieldsto 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.
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>
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.
When a class inherits fields from a parent class, they are put into a
:_0field, which used to be fully ignored. Instead, I made those anonymous, so that they are transparent and reveal their subfields.