Repository navigation
Conversation
a9c8734 to
8333a10
Compare
Test Results 23 files 23 suites 3d 12h 29m 3s ⏱️ For more details on these failures, see this check. Results for commit 8333a10. |
2fc5b05 to
95d209d
Compare
| Without dictionaries, RNTuple can still read data with an emulated schema derived from the RNTuple fields. | ||
| Type emulation reads classes as untyped records, collections as `std::vector`s, and custom enums as integers. | ||
| Type emulation works for all fields except streamer fields. | ||
| Emulated types cannot be used for writing, but they can be used for merging. |
There was a problem hiding this comment.
I guess this technically means that Emulated types can not be used to create field (but can be used for writing when merging). (Related questions, since the slow merging can append entries to existing RNTuple, can a clever user find a way to leverage that code to also write into an existing RNTuple?)
There was a problem hiding this comment.
The merger does not close the output ntuple during merging, so it's not really appending to an existing one...
| @@ -0,0 +1,111 @@ | |||
| # SoA I/O in RNTuple | |||
|
|
|||
| RNTuple has a mechanism to represent a collection of a class, i.e. an "array of struct" (AoS), | |||
There was a problem hiding this comment.
represent
Would read back or connect be more accurate?
There was a problem hiding this comment.
Changed to read and write
| The data type of that data member in the SoA class must be either `RVec<T>` or | ||
| a SoA type that has `T` as an underlying record type (nested SoA type). | ||
| The SoA type must have no additional persistent data members. | ||
| - The SoA type and its underlying record type must have the same class version number. |
There was a problem hiding this comment.
Is that a fundamental limitation? In particular this means that un-versioned class/struct are not eligible to be SOA. Should it be made more pro-eminent that the class need be versioned (either via a ClassDef (intrusive) or via a dictionary generation annotation (non intrusive to the underlying record type)?
There was a problem hiding this comment.
It's not a fundamental limitation, it is a limitation that we just impose for sanity. With this limitation, yes, I would like to not make SoA types available as unversioned class.
| The SoA type must have no additional persistent data members. | ||
| - The SoA type and its underlying record type must have the same class version number. | ||
|
|
||
| These conditions are checked at runtime when an `RSoAField` is created. |
There was a problem hiding this comment.
Related to the question about version. Does it also check that the class is versioned or just that the class version match (2 un-versioned classes might have matching version by happenstance ... in which case upon reading back they may not have the same assigned version number).
There was a problem hiding this comment.
We may be susceptible to this. The goal is enforcing versioned classes: #23749
| - For every persistent member of type `T` in the underlying record type, | ||
| there must be a member with the same name in the SoA type. | ||
| The data type of that data member in the SoA class must be either `RVec<T>` or | ||
| a SoA type that has `T` as an underlying record type (nested SoA type). |
There was a problem hiding this comment.
| a SoA type that has `T` as an underlying record type (nested SoA type). | |
| a SoA type that has `T` as an underlying record type (nested SoA type). | |
| - For all the (persisted) instances of the SoA all the persistent data members much have the same number of elements. |
There was a problem hiding this comment.
Yes, however that's not a restriction on the type. A few lines further down we have the line
Equal vector lengths are ensured by construction when reading from disk and checked when writing to disk.
There was a problem hiding this comment.
It is an invariant of the class. The next section is different in a bit in nature. I.e. When I am reading it, I see this section as "this is what the class must have" while the later section is "and here is how we enforce those requirements"
There was a problem hiding this comment.
Makes sense. I added a bullet point along these lines.
| For added members, reading will set the corresponding vector(s) to the collection length | ||
| and default-initialize the vector elements. | ||
| This is different to added members of normal classes, for which reading is a no-op. |
There was a problem hiding this comment.
This implies that the default-initialize is executed at each entry read. Is that correct? (i.e. at each entry we do the moral equivalent of vec.clear(); vec.resize(n);)
There was a problem hiding this comment.
Yes, that is correct.
95d209d to
93c3af9
Compare
93c3af9 to
1cf6381
Compare
Part of #19230
This should be merged once the first complete version of the code is ready. Submitted as a preview PR.