Skip to content

[ntuple] detect runtime member streamers via TRealData#21281

Merged
jblomer merged 1 commit intoroot-project:masterfrom
JasMehta08:detect-custom-streamers
Mar 9, 2026
Merged

[ntuple] detect runtime member streamers via TRealData#21281
jblomer merged 1 commit intoroot-project:masterfrom
JasMehta08:detect-custom-streamers

Conversation

@JasMehta08
Copy link
Contributor

This Pull request:

Changes or fixes:

When a class member has a custom streamer set at runtime via TClass::SetMemberStreamer() or TClass::AdoptMemberStreamer(),

RFieldBase::Create() now detects this by iterating TRealData and checking TRealData::GetStreamer().

If any member has a custom streamer, an RStreamerField is used instead of RClassField, preventing the class from being split into columns which would bypass the member's custom serialization logic.

Checklist:

  • tested changes locally

This PR fixes #20448

Copy link
Contributor

@jblomer jblomer left a comment

Choose a reason for hiding this comment

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

Thank you!

I think that automatically using a streamer field is undesired. Custom member streamers are a rare case and for now, I think we should simply detect this case in RClassField and fail with an error message.

We would also need a test for this.

@JasMehta08 JasMehta08 force-pushed the detect-custom-streamers branch from c4e0f67 to 695bd21 Compare March 4, 2026 08:34
@JasMehta08
Copy link
Contributor Author

@jblomer

I have updated the PR,

  • I moved the check to RFieldMeta.cxx to detect if any member has
    custom streamer present, and to throw error if it is present.
  • I have also added a test for the same.

Please let me know if I should change anything.

Thanks!

@JasMehta08 JasMehta08 requested a review from jblomer March 4, 2026 08:43
Copy link
Contributor

@jblomer jblomer left a comment

Choose a reason for hiding this comment

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

Looks quite close to being merge ready!

@JasMehta08 JasMehta08 force-pushed the detect-custom-streamers branch from 695bd21 to b1324a7 Compare March 4, 2026 18:46
@JasMehta08
Copy link
Contributor Author

JasMehta08 commented Mar 4, 2026

@jblomer

i have updated the code,

  • i used the snippet provided by you.
  • also added the Cansplit() test
  • and move the test to rfield_class.cxx

Thanks!

@JasMehta08 JasMehta08 force-pushed the detect-custom-streamers branch from b1324a7 to f6314db Compare March 5, 2026 05:12
@JasMehta08 JasMehta08 requested a review from jblomer March 5, 2026 05:13
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Test Results

    22 files      22 suites   3d 3h 14m 32s ⏱️
 3 831 tests  3 830 ✅ 1 💤 0 ❌
75 737 runs  75 728 ✅ 9 💤 0 ❌

Results for commit 9243edc.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@jblomer jblomer left a comment

Choose a reason for hiding this comment

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

In principle looks good to me but see the CI report (missing TBuffer.h include)

@JasMehta08
Copy link
Contributor Author

JasMehta08 commented Mar 5, 2026

@jblomer
I think the segmentation errors is caused by the GetListOfRealData() returns nullptr because we are not checking for that and trying to access it.
Do you think that fixing that would fix the errors? if so, should I add a if check?

@JasMehta08 JasMehta08 force-pushed the detect-custom-streamers branch from f6314db to 14a18ab Compare March 5, 2026 12:10
@JasMehta08
Copy link
Contributor Author

@jblomer

I have added the changes that you had pointed out about
the missing header and the updated the class version.

I also changed the code snippet as i think it is the cause of the segmentation fault.
Please let me know if i have gotten the reasoning behind the segmentation fault wrong.

Thanks!

@JasMehta08 JasMehta08 requested a review from jblomer March 5, 2026 12:41
@JasMehta08 JasMehta08 force-pushed the detect-custom-streamers branch from 14a18ab to 3a10633 Compare March 7, 2026 06:52
@JasMehta08 JasMehta08 force-pushed the detect-custom-streamers branch from 3a10633 to 9243edc Compare March 7, 2026 06:58
@JasMehta08
Copy link
Contributor Author

@pcanal

I have made the changes to use BuildRealData() if GetListRealData() returns a nullptr, and went back to using the snippet provided by @jblomer , that is
for (auto realMember : ROOT::Detail::TRangeStaticCast<TRealData>(*fClass->GetListOfRealData())) {
I hope those are the only changes that are necessary.

Thanks!

@JasMehta08 JasMehta08 requested a review from pcanal March 7, 2026 12:23
@jblomer jblomer merged commit f078d34 into root-project:master Mar 9, 2026
30 checks passed
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.

[ntuple] detect custom streamers of class members

3 participants