-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[ntuple] Register post-read callbacks for #pragma read rules on user-defined classes
#11944
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
[ntuple] Register post-read callbacks for #pragma read rules on user-defined classes
#11944
Conversation
Introduce `RFieldBase::AddReadCallbacksFromIORules()`. This function registers a post-read callback for each of the given `ROOT::TSchemaRule`s.
I/O customization rules referencing non-transient members are ignored for now. Such rules shall trigger a warning, e.g. ``` 210: Warning in <[ROOT.NTuple] Warning /home/jalopezg/CERN/repos/root/tree/ntuple/v7/src/RField.cxx:931 in ROOT::Experimental::RClassField::RClassField(std::string_view, std::string_view, TClass*)::<lambda(const ROOT::TSchemaRule*)>>: ignoring I/O customization rule with non-transient member: a ```
|
Starting build on |
jblomer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! I think we should be able to check the class version as well. We should store the class version on disk and compare it with the rule version.
|
Starting build on |
|
Build failed on ROOT-ubuntu18.04/nortcxxmod. Warnings:
And 298 more Failing tests:
|
|
Build failed on windows10/cxx14. |
|
Build failed on mac12/noimt. Warnings:
And 285 more Failing tests:
|
|
Build failed on ROOT-debian10-i386/soversion. Warnings:
And 220 more |
|
Build failed on ROOT-ubuntu2004/python3. Warnings:
And 286 more Failing tests:
|
|
Build failed on mac11/cxx14. Warnings:
And 286 more Failing tests:
|
|
Build failed on ROOT-performance-centos8-multicore/cxx17. Warnings:
And 367 more Failing tests:
|
Cache the C++ type version for the field as specified in the `RNTupleDescriptor` during a `ConnectPageSource()` call. The type version is made available via `GetOnDiskTypeVersion()`.
- Oftentimes, read callback registration depends on information that is only available after the field is connected to a page source, e.g. the on-disk C++ type version. Therefore, this commit introduces `RFieldBase::RegisterReadCallbacks()` that is called at the end of `ConnectPageSource()` to register post-read callbacks as appropriate. The function can be overridden by derived classes. - Update `RNTupleView` constructor: check if field has callbacks after the `ConnectPageSource()` call.
|
Starting build on |
|
Build failed on ROOT-ubuntu18.04/nortcxxmod. Warnings:
And 60 more Failing tests:
|
|
Build failed on mac12/noimt. Warnings:
And 53 more Failing tests:
|
|
Build failed on ROOT-ubuntu2004/python3. Warnings:
And 54 more Failing tests:
|
|
Build failed on mac11/cxx14. Errors:
Warnings:
And 54 more Failing tests:
And 7 more |
|
Build failed on ROOT-performance-centos8-multicore/cxx17. Errors:
Warnings:
And 130 more Failing tests:
And 10 more |
|
Starting build on |
Fair enough (and... done!). |
|
Build failed on ROOT-performance-centos8-multicore/cxx17. Errors:
Warnings:
And 130 more Failing tests:
And 7 more |
|
Build failed on ROOT-ubuntu2004/python3. Warnings:
And 54 more Failing tests:
|
|
Build failed on ROOT-ubuntu18.04/nortcxxmod. Warnings:
And 60 more Failing tests:
|
|
Build failed on mac12/noimt. Warnings:
And 53 more Failing tests:
|
|
Build failed on mac11/cxx14. Errors:
Warnings:
And 54 more Failing tests:
And 7 more |
jblomer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, nice work!
Some minor comments and then it's ready to get merged. Just wondering, the unit tests should print warnings, which we may need to add to the list of expected warnings.
Co-authored-by: Jakob Blomer <jblomer@cern.ch>
|
Starting build on |
|
Starting build on |
|
Build failed on ROOT-performance-centos8-multicore/cxx17. Errors:
|
|
Build failed on mac11/cxx14. |
Co-authored-by: Jakob Blomer <jblomer@cern.ch>
f2e10f8 to
6da2d26
Compare
|
Starting build on |
Pull request #11731 introduced internal support for per field post-read callbacks. This follow-up pull request registers a callback for each
#pragma readrule on user-defined classes.Currently,
#pragma readrules referencing non-transient members as atargetare intentionally disallowed -- a warning is logged in that case. Only target class version is checked, i.e. checksum is ignored.Raw read rules are not (and will likely not be) supported, as they take a
TBuffer &.Changes or fixes:
RFieldBase::AddReadCallbacksFromIORules(). This function registers a post-read callback for each of the givenROOT::TSchemaRules.RFieldBase::ConnectPageSource(): cache C++ type version as stored in the RNTupleDescriptor. This information can be accessed viaGetOnDiskTypeVersion().RFieldBase::RegisterReadCallbacks()is called as part ofConnectPageSource(). This function can be overridden; in particular, derived classes can make use of the on-disk type version to enable/disable read rules.Checklist:
This PR partially takes care of #10019.