Skip to content

Avoid including ambiguous TTree branch names #19399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vepadulano
Copy link
Member

When the input data source is a TTree, GetColumnNames gathers the list of all the available TTree branches. In case there are two branches in the tree (e.g. el1 and el2), each of them has a sub-branch with the same name (e.g. electron_pt), TTree allows calling GetBranch("electron_pt") and returns the pointer to the sub-branch of the first main branch (i.e. el1.electron_pt). This behaviour can lead to ambiguities, thus avoid exposing the ambiguous column name via RDF.

A test is added to exemplify this case.

This PR fixes #19392

Note that it is a draft PR as the fix is fairly obvious but I am not sure that it won't break other tests

When the input data source is a TTree, GetColumnNames gathers the list of all
the available TTree branches. In case there are two branches in the tree (e.g.
`el1` and `el2`), each of them has a sub-branch with the same name (e.g.
`electron_pt`), TTree allows calling `GetBranch("electron_pt")` and returns the
pointer to the sub-branch of the first main branch (i.e. `el1.electron_pt`).
This behaviour can lead to ambiguities, thus avoid exposing the ambiguous column
name via RDF.

A test is added to exemplify this case.
@vepadulano vepadulano requested review from pcanal and enirolf July 17, 2025 14:05
@vepadulano vepadulano self-assigned this Jul 17, 2025
@vepadulano vepadulano closed this Jul 17, 2025
@vepadulano vepadulano reopened this Jul 17, 2025
@vepadulano vepadulano added the clean build Ask CI to do non-incremental build on PR label Jul 17, 2025
@vepadulano vepadulano closed this Jul 17, 2025
@vepadulano vepadulano reopened this Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean build Ask CI to do non-incremental build on PR in:RDataFrame in:TTree
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[df] Sub-branches get wrongly added as top-level columns
1 participant