[ntuple] Attributes: add support for writing#21289
[ntuple] Attributes: add support for writing#21289silverweed wants to merge 10 commits intoroot-project:masterfrom
Conversation
Test Results 17 files 17 suites 2d 11h 58m 51s ⏱️ Results for commit 0e6734f. ♻️ This comment has been updated with latest results. |
16e0a45 to
9b598df
Compare
9b598df to
505da84
Compare
hahnjo
left a comment
There was a problem hiding this comment.
A first review... I think one high-level decision to make is where to build RNTupleAttrSetDescriptor. RNTupleFileWriter feels like the wrong place to do this.
| #ifndef ROOT7_RNTuple_Attributes | ||
| #define ROOT7_RNTuple_Attributes |
There was a problem hiding this comment.
A while ago, we started having one header per class. I think we should keep this pattern and split the header RNTupleAttributes.hxx proposed here
There was a problem hiding this comment.
We still have some exceptions where it makes sense (RNTupleDescriptor.hxx, RNTupleUtils.hxx, ...); I'm not sure that splitting this would bring much value - perhaps the splitting could be made at the reading vs writing level?
There was a problem hiding this comment.
Yes, some classes are still "bundled" - agreed on the reading vs writing level. Probably that will need some more headers for classes shared between the two (?)
| inline const std::uint16_t kSchemaVersionMajor = 1; | ||
| inline const std::uint16_t kSchemaVersionMinor = 0; |
There was a problem hiding this comment.
Should these move into the RNTuple class where we have the other constants such as kVersionEpoch?
There was a problem hiding this comment.
Possibly; though these only concern attributes so it's not necessarily interesting for users of the RNTuple class. It's a matter of deciding whether we want to centralize these binary specs-related constants or not.
I have no strong opinion either way.
There was a problem hiding this comment.
Thinking again about this, I'd not put these in RNTuple as that's only one specific anchor, whereas these constants are anchor-agnostic.
If anything they might live in the Serializer, but I'd rather keep them close to the other related constants (rangeStartFieldName etc).
Probably in a separate header that is only included by some cxx file and not directly exposed to users.
There was a problem hiding this comment.
AFAICT we are already using the constants in RNTuple to initialize the RNTupleDescriptorBuilder...
There was a problem hiding this comment.
That's true, but I'm not sure that was the best decision on our side. In retrospect, I'd probably have put them in some dedicated namespace (although I see the argument of using the RNTuple name to namespace them)...
|
Thanks for the thorough review @hahnjo! For the descriptor building I agree it feels weird to have it in the Writer; let's talk about it offline. |
2d7c429 to
b20c52b
Compare
b20c52b to
0e6734f
Compare
| friend class ROOT::RNTupleFillContext; | ||
| friend class ROOT::RNTupleWriter; |
There was a problem hiding this comment.
The wrong friend declaration should probably be removed from the original commit...
| friend class ROOT::RNTupleFillContext; | ||
| friend class ROOT::RNTupleWriter; |
| /// NOTE: this is a deque to keep pointers stable upon adding/removing, but have deterministic iteration at the | ||
| /// same time. |
There was a problem hiding this comment.
Do we need this stability guarantee?
| // NOTE: references into attrSets are guaranteed to be stable, so we can hand out the reference | ||
| // to the AttrSetWriter's shared_ptr into the handle. | ||
| return Experimental::RNTupleAttrSetWriterHandle{addedSet}; |
There was a problem hiding this comment.
Do we need this guarantee? RNTupleAttrSetWriterHandle (currently) creates a std::weak_ptr, which precisely has the point that the shared_ptr doesn't need to stay around...
This Pull request:
adds the
RNTupleAttrSetWriterclass and initial support for writing attributes. This involves touching, among other classes, the RNTupleWriter, RNTupleFillContext, RPageSink and RMiniFile.Original reference PR (now quite outdated): #19153
Checklist: