Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleDescriptor.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleDescriptor.hxx
2/// \ingroup NTuple
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \author Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
5/// \date 2018-07-19
6
7/*************************************************************************
8 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
9 * All rights reserved. *
10 * *
11 * For the licensing terms see $ROOTSYS/LICENSE. *
12 * For the list of contributors see $ROOTSYS/README/CREDITS. *
13 *************************************************************************/
14
15#ifndef ROOT_RNTupleDescriptor
16#define ROOT_RNTupleDescriptor
17
19#include <ROOT/RError.hxx>
21#include <ROOT/RNTupleTypes.hxx>
22#include <ROOT/RSpan.hxx>
23
24#include <TError.h>
25
26#include <algorithm>
27#include <chrono>
28#include <cmath>
29#include <functional>
30#include <iterator>
31#include <map>
32#include <memory>
33#include <optional>
34#include <ostream>
35#include <vector>
36#include <set>
37#include <string>
38#include <string_view>
39#include <unordered_map>
40#include <unordered_set>
41
42namespace ROOT {
43
44class RFieldBase;
45class RNTupleModel;
46
47namespace Internal {
48class RColumnElementBase;
49}
50
51class RNTupleDescriptor;
52
53namespace Internal {
54class RColumnDescriptorBuilder;
55class RClusterDescriptorBuilder;
56class RClusterGroupDescriptorBuilder;
57class RExtraTypeInfoDescriptorBuilder;
58class RFieldDescriptorBuilder;
59class RNTupleDescriptorBuilder;
60
61RNTupleDescriptor CloneDescriptorSchema(const RNTupleDescriptor &desc);
66
67std::vector<ROOT::Internal::RNTupleClusterBoundaries> GetClusterBoundaries(const RNTupleDescriptor &desc);
68} // namespace Internal
69
70// clang-format off
71/**
72\class ROOT::RFieldDescriptor
73\ingroup NTuple
74\brief Metadata stored for every field of an RNTuple
75*/
76// clang-format on
80
81private:
83 /// The version of the C++-type-to-column translation mechanics
84 std::uint32_t fFieldVersion = 0;
85 /// The version of the C++ type itself
86 std::uint32_t fTypeVersion = 0;
87 /// The leaf name, not including parent fields
88 std::string fFieldName;
89 /// Free text set by the user
90 std::string fFieldDescription;
91 /// The C++ type that was used when writing the field
92 std::string fTypeName;
93 /// A typedef or using directive that resolved to the type name during field creation
94 std::string fTypeAlias;
95 /// The number of elements per entry for fixed-size arrays
96 std::uint64_t fNRepetitions = 0;
97 /// The structural information carried by this field in the data model tree
99 /// Establishes sub field relationships, such as classes and collections
101 /// For projected fields, the source field ID
103 /// The pointers in the other direction from parent to children. They are serialized, too, to keep the
104 /// order of sub fields.
105 std::vector<ROOT::DescriptorId_t> fLinkIds;
106 /// The number of columns in the column representations of the field. The column cardinality helps to navigate the
107 /// list of logical column ids. For example, the second column of the third column representation is
108 /// fLogicalColumnIds[2 * fColumnCardinality + 1]
109 std::uint32_t fColumnCardinality = 0;
110 /// The ordered list of columns attached to this field: first by representation index then by column index.
111 std::vector<ROOT::DescriptorId_t> fLogicalColumnIds;
112 /// For custom classes, we store the ROOT TClass reported checksum to facilitate the use of I/O rules that
113 /// identify types by their checksum
114 std::optional<std::uint32_t> fTypeChecksum;
115
116public:
117 RFieldDescriptor() = default;
122
123 bool operator==(const RFieldDescriptor &other) const;
124 /// Get a copy of the descriptor
125 RFieldDescriptor Clone() const;
126
127 /// In general, we create a field simply from the C++ type name. For untyped fields, however, we potentially need
128 /// access to sub fields, which is provided by the RNTupleDescriptor argument.
129 std::unique_ptr<ROOT::RFieldBase>
130 CreateField(const RNTupleDescriptor &ntplDesc, const ROOT::RCreateFieldOptions &options = {}) const;
131
133 std::uint32_t GetFieldVersion() const { return fFieldVersion; }
134 std::uint32_t GetTypeVersion() const { return fTypeVersion; }
135 const std::string &GetFieldName() const { return fFieldName; }
136 const std::string &GetFieldDescription() const { return fFieldDescription; }
137 const std::string &GetTypeName() const { return fTypeName; }
138 const std::string &GetTypeAlias() const { return fTypeAlias; }
139 std::uint64_t GetNRepetitions() const { return fNRepetitions; }
143 const std::vector<ROOT::DescriptorId_t> &GetLinkIds() const { return fLinkIds; }
144 const std::vector<ROOT::DescriptorId_t> &GetLogicalColumnIds() const { return fLogicalColumnIds; }
145 std::uint32_t GetColumnCardinality() const { return fColumnCardinality; }
146 std::optional<std::uint32_t> GetTypeChecksum() const { return fTypeChecksum; }
148 /// Tells if the field describes a user-defined class rather than a fundamental type, a collection, or one of the
149 /// natively supported stdlib classes.
150 /// The dictionary does not need to be available for this method.
151 bool IsCustomClass() const;
152};
153
154// clang-format off
155/**
156\class ROOT::RColumnDescriptor
157\ingroup NTuple
158\brief Metadata stored for every column of an RNTuple
159*/
160// clang-format on
164
165public:
166 struct RValueRange {
167 double fMin = 0, fMax = 0;
168
169 RValueRange() = default;
170 RValueRange(double min, double max) : fMin(min), fMax(max) {}
171 RValueRange(std::pair<double, double> range) : fMin(range.first), fMax(range.second) {}
172
173 bool operator==(RValueRange other) const { return fMin == other.fMin && fMax == other.fMax; }
174 bool operator!=(RValueRange other) const { return !(*this == other); }
175 };
176
177private:
178 /// The actual column identifier, which is the link to the corresponding field
180 /// Usually identical to the logical column ID, except for alias columns where it references the shadowed column
182 /// Every column belongs to one and only one field
184 /// The absolute value specifies the index for the first stored element for this column.
185 /// For deferred columns the absolute value is larger than zero.
186 /// Negative values specify a suppressed and deferred column.
187 std::int64_t fFirstElementIndex = 0U;
188 /// A field can be serialized into several columns, which are numbered from zero to $n$
189 std::uint32_t fIndex = 0;
190 /// A field may use multiple column representations, which are numbered from zero to $m$.
191 /// Every representation has the same number of columns.
192 std::uint16_t fRepresentationIndex = 0;
193 /// The size in bits of elements of this column. Most columns have the size fixed by their type
194 /// but low-precision float columns have variable bit widths.
195 std::uint16_t fBitsOnStorage = 0;
196 /// The on-disk column type
198 /// Optional value range (used e.g. by quantized real fields)
199 std::optional<RValueRange> fValueRange;
200
201public:
202 RColumnDescriptor() = default;
207
208 bool operator==(const RColumnDescriptor &other) const;
209 /// Get a copy of the descriptor
210 RColumnDescriptor Clone() const;
211
215 std::uint32_t GetIndex() const { return fIndex; }
216 std::uint16_t GetRepresentationIndex() const { return fRepresentationIndex; }
217 std::uint64_t GetFirstElementIndex() const { return std::abs(fFirstElementIndex); }
218 std::uint16_t GetBitsOnStorage() const { return fBitsOnStorage; }
220 std::optional<RValueRange> GetValueRange() const { return fValueRange; }
222 bool IsDeferredColumn() const { return fFirstElementIndex != 0; }
224};
225
226// clang-format off
227/**
228\class ROOT::RClusterDescriptor
229\ingroup NTuple
230\brief Metadata for RNTuple clusters
231
232The cluster descriptor is built in two phases. In a first phase, the descriptor has only an ID.
233In a second phase, the event range, column group, page locations and column ranges are added.
234Both phases are populated by the RClusterDescriptorBuilder.
235Clusters span across all available columns in the RNTuple.
236*/
237// clang-format on
240
241public:
242 // clang-format off
243 /**
244 \class ROOT::RClusterDescriptor::RColumnRange
245 \ingroup NTuple
246 \brief The window of element indexes of a particular column in a particular cluster
247 */
248 // clang-format on
251 /// The global index of the first column element in the cluster
253 /// The number of column elements in the cluster
255 /// The usual format for ROOT compression settings (see Compression.h).
256 /// The pages of a particular column in a particular cluster are all compressed with the same settings.
257 /// If unset, the compression settings are undefined (deferred columns, suppressed columns).
258 std::optional<std::uint32_t> fCompressionSettings;
259 /// Suppressed columns have an empty page range and unknown compression settings.
260 /// Their element index range, however, is aligned with the corresponding column of the
261 /// primary column representation (see Section "Suppressed Columns" in the specification)
262 bool fIsSuppressed = false;
263
264 // TODO(jblomer): we perhaps want to store summary information, such as average, min/max, etc.
265 // Should this be done on the field level?
266
267 public:
268 RColumnRange() = default;
269
280
283
287
291
292 std::optional<std::uint32_t> GetCompressionSettings() const { return fCompressionSettings; }
293 void SetCompressionSettings(std::optional<std::uint32_t> comp) { fCompressionSettings = comp; }
294
295 bool IsSuppressed() const { return fIsSuppressed; }
297
298 bool operator==(const RColumnRange &other) const
299 {
300 return fPhysicalColumnId == other.fPhysicalColumnId && fFirstElementIndex == other.fFirstElementIndex &&
301 fNElements == other.fNElements && fCompressionSettings == other.fCompressionSettings &&
302 fIsSuppressed == other.fIsSuppressed;
303 }
304
309 };
310
311 // clang-format off
312 /**
313 \class ROOT::RClusterDescriptor::RPageInfo
314 \ingroup NTuple
315 \brief Information about a single page in the context of a cluster's page range.
316 */
317 // clang-format on
318 // NOTE: We do not need to store the element size / uncompressed page size because we know to which column
319 // the page belongs
320 struct RPageInfo {
321 private:
322 /// The sum of the elements of all the pages must match the corresponding `fNElements` field in `fColumnRanges`
323 std::uint32_t fNElements = std::uint32_t(-1);
324 /// The meaning of `fLocator` depends on the storage backend.
326 /// If true, the 8 bytes following the serialized page are an xxhash of the on-disk page data
327 bool fHasChecksum = false;
328
329 public:
330 RPageInfo() = default;
335
336 bool operator==(const RPageInfo &other) const
337 {
338 return fNElements == other.fNElements && fLocator == other.fLocator;
339 }
340
341 std::uint32_t GetNElements() const { return fNElements; }
342 void SetNElements(std::uint32_t n) { fNElements = n; }
343
344 const RNTupleLocator &GetLocator() const { return fLocator; }
347
348 bool HasChecksum() const { return fHasChecksum; }
350 };
351
352 // clang-format off
353 /**
354 \class ROOT::RClusterDescriptor::RPageInfoExtended
355 \ingroup NTuple
356 \brief Additional information about a page in an in-memory RPageRange.
357
358 Used by RPageRange::Find() to return information relative to the RPageRange. This information is not stored on disk
359 and we don't need to keep it in memory because it can be easily recomputed.
360 */
361 // clang-format on
382
383 // clang-format off
384 /**
385 \class ROOT::RClusterDescriptor::RPageRange
386 \ingroup NTuple
387 \brief Records the partition of data into pages for a particular column in a particular cluster
388 */
389 // clang-format on
392
393 private:
394 /// \brief Extend this RPageRange to fit the given RColumnRange.
395 ///
396 /// To do so, prepend as many synthetic RPageInfos as needed to cover the range in `columnRange`.
397 /// RPageInfos are constructed to contain as many elements of type `element` given a page size
398 /// limit of `pageSize` (in bytes); the locator for the referenced pages is `kTypePageZero`.
399 /// This function is used to make up RPageRanges for clusters that contain deferred columns.
400 /// \return The number of column elements covered by the synthesized RPageInfos
403
404 /// Has the same length than fPageInfos and stores the sum of the number of elements of all the pages
405 /// up to and including a given index. Used for binary search in Find().
406 std::vector<ROOT::NTupleSize_t> fCumulativeNElements;
407
409 std::vector<RPageInfo> fPageInfos;
410
411 public:
412 RPageRange() = default;
413 RPageRange(const RPageRange &other) = delete;
417
419 {
420 RPageRange clone;
422 clone.fPageInfos = fPageInfos;
424 return clone;
425 }
426
427 /// Find the page in the RPageRange that contains the given element. The element must exist.
429
432
433 const std::vector<RPageInfo> &GetPageInfos() const { return fPageInfos; }
434 std::vector<RPageInfo> &GetPageInfos() { return fPageInfos; }
435
436 bool operator==(const RPageRange &other) const
437 {
438 return fPhysicalColumnId == other.fPhysicalColumnId && fPageInfos == other.fPageInfos;
439 }
440 };
441
442private:
444 /// Clusters can be swapped by adjusting the entry offsets of the cluster and all ranges
447
448 std::unordered_map<ROOT::DescriptorId_t, RColumnRange> fColumnRanges;
449 std::unordered_map<ROOT::DescriptorId_t, RPageRange> fPageRanges;
450
451public:
453
459
461
462 bool operator==(const RClusterDescriptor &other) const;
463
469 /// Returns an iterator over pairs { columnId, columnRange }. The iteration order is unspecified.
470 RColumnRangeIterable GetColumnRangeIterable() const;
472 {
473 return fColumnRanges.find(physicalId) != fColumnRanges.end();
474 }
475 std::uint64_t GetNBytesOnStorage() const;
476};
477
479private:
481
482public:
484 private:
485 using Iter_t = std::unordered_map<ROOT::DescriptorId_t, RColumnRange>::const_iterator;
486 /// The wrapped map iterator
488
489 public:
490 using iterator_category = std::forward_iterator_tag;
493 using difference_type = std::ptrdiff_t;
494 using pointer = const RColumnRange *;
495 using reference = const RColumnRange &;
496
497 RIterator(Iter_t iter) : fIter(iter) {}
499 {
500 ++fIter;
501 return *this;
502 }
503 reference operator*() { return fIter->second; }
504 pointer operator->() { return &fIter->second; }
505 bool operator!=(const iterator &rh) const { return fIter != rh.fIter; }
506 bool operator==(const iterator &rh) const { return fIter == rh.fIter; }
507 };
508
509 explicit RColumnRangeIterable(const RClusterDescriptor &desc) : fDesc(desc) {}
510
511 RIterator begin() { return RIterator{fDesc.fColumnRanges.cbegin()}; }
512 RIterator end() { return fDesc.fColumnRanges.cend(); }
513 size_t size() { return fDesc.fColumnRanges.size(); }
514};
515
516// clang-format off
517/**
518\class ROOT::RClusterGroupDescriptor
519\ingroup NTuple
520\brief Clusters are bundled in cluster groups.
521
522Very large RNTuples can contain multiple cluster groups to organize cluster metadata.
523Every RNTuple has at least one cluster group. The clusters in a cluster group are ordered
524corresponding to their first entry number.
525*/
526// clang-format on
529
530private:
532 /// The cluster IDs can be empty if the corresponding page list is not loaded.
533 /// Otherwise, cluster ids are sorted by first entry number.
534 std::vector<ROOT::DescriptorId_t> fClusterIds;
535 /// The page list that corresponds to the cluster group
537 /// Uncompressed size of the page list
538 std::uint64_t fPageListLength = 0;
539 /// The minimum first entry number of the clusters in the cluster group
540 std::uint64_t fMinEntry = 0;
541 /// Number of entries that are (partially for sharded clusters) covered by this cluster group.
542 std::uint64_t fEntrySpan = 0;
543 /// Number of clusters is always known even if the cluster IDs are not (yet) populated
544 std::uint32_t fNClusters = 0;
545
546public:
552
554 /// Creates a clone without the cluster IDs
556
557 bool operator==(const RClusterGroupDescriptor &other) const;
558
560 std::uint32_t GetNClusters() const { return fNClusters; }
562 std::uint64_t GetPageListLength() const { return fPageListLength; }
563 const std::vector<ROOT::DescriptorId_t> &GetClusterIds() const { return fClusterIds; }
564 std::uint64_t GetMinEntry() const { return fMinEntry; }
565 std::uint64_t GetEntrySpan() const { return fEntrySpan; }
566 /// A cluster group is loaded in two stages. Stage one loads only the summary information.
567 /// Stage two loads the list of cluster IDs.
568 bool HasClusterDetails() const { return !fClusterIds.empty(); }
569};
570
571/// Used in RExtraTypeInfoDescriptor
573 kInvalid,
575};
576
577// clang-format off
578/**
579\class ROOT::RExtraTypeInfoDescriptor
580\ingroup NTuple
581\brief Field specific extra type information from the header / extenstion header
582
583Currently only used by streamer fields to store RNTuple-wide list of streamer info records.
584*/
585// clang-format on
588
589private:
590 /// Specifies the meaning of the extra information
592 /// Type version the extra type information is bound to
593 std::uint32_t fTypeVersion = 0;
594 /// The type name the extra information refers to; empty for RNTuple-wide extra information
595 std::string fTypeName;
596 /// The content format depends on the content ID and may be binary
597 std::string fContent;
598
599public:
605
606 bool operator==(const RExtraTypeInfoDescriptor &other) const;
607
609
611 std::uint32_t GetTypeVersion() const { return fTypeVersion; }
612 const std::string &GetTypeName() const { return fTypeName; }
613 const std::string &GetContent() const { return fContent; }
614};
615
616// clang-format off
617/**
618\class ROOT::RNTupleDescriptor
619\ingroup NTuple
620\brief The on-storage metadata of an RNTuple
621
622Represents the on-disk (on storage) information about an RNTuple. The metadata consists of a header, a footer, and
623potentially multiple page lists.
624The header carries the RNTuple schema, i.e. the fields and the associated columns and their relationships.
625The footer carries information about one or several cluster groups and links to their page lists.
626For every cluster group, a page list envelope stores cluster summaries and page locations.
627For every cluster, it stores for every column the range of element indexes as well as a list of pages and page
628locations.
629
630The descriptor provides machine-independent (de-)serialization of headers and footers, and it provides lookup routines
631for RNTuple objects (pages, clusters, ...). It is supposed to be usable by all RPageStorage implementations.
632
633The serialization does not use standard ROOT streamers in order to not let it depend on libCore. The serialization uses
634the concept of envelopes and frames: header, footer, and page list envelopes have a preamble with a type ID and length.
635Substructures are serialized in frames and have a size and number of items (for list frames). This allows for forward
636and backward compatibility when the metadata evolves.
637*/
638// clang-format on
642
643public:
644 class RHeaderExtension;
645
646private:
647 /// The RNTuple name needs to be unique in a given storage location (file)
648 std::string fName;
649 /// Free text from the user
650 std::string fDescription;
651
653
654 std::uint64_t fNPhysicalColumns = 0; ///< Updated by the descriptor builder when columns are added
655
656 std::set<unsigned int> fFeatureFlags;
657 std::unordered_map<ROOT::DescriptorId_t, RFieldDescriptor> fFieldDescriptors;
658 std::unordered_map<ROOT::DescriptorId_t, RColumnDescriptor> fColumnDescriptors;
659
660 std::vector<RExtraTypeInfoDescriptor> fExtraTypeInfoDescriptors;
661 std::unique_ptr<RHeaderExtension> fHeaderExtension;
662
663 //// All fields above are part of the schema and are cloned when creating a new descriptor from a given one
664 //// (see CloneSchema())
665
666 std::uint16_t fVersionEpoch = 0; ///< Set by the descriptor builder when deserialized
667 std::uint16_t fVersionMajor = 0; ///< Set by the descriptor builder when deserialized
668 std::uint16_t fVersionMinor = 0; ///< Set by the descriptor builder when deserialized
669 std::uint16_t fVersionPatch = 0; ///< Set by the descriptor builder when deserialized
670
671 std::uint64_t fOnDiskHeaderSize = 0; ///< Set by the descriptor builder when deserialized
672 std::uint64_t fOnDiskHeaderXxHash3 = 0; ///< Set by the descriptor builder when deserialized
673 std::uint64_t fOnDiskFooterSize = 0; ///< Like fOnDiskHeaderSize, contains both cluster summaries and page locations
674
675 std::uint64_t fNEntries = 0; ///< Updated by the descriptor builder when the cluster groups are added
676 std::uint64_t fNClusters = 0; ///< Updated by the descriptor builder when the cluster groups are added
677
678 /// \brief The generation of the descriptor
679 ///
680 /// Once constructed by an RNTupleDescriptorBuilder, the descriptor is mostly immutable except for the set of
681 /// active page locations. During the lifetime of the descriptor, page location information for clusters
682 /// can be added or removed. When this happens, the generation should be increased, so that users of the
683 /// descriptor know that the information changed. The generation is increased, e.g., by the page source's
684 /// exclusive lock guard around the descriptor. It is used, e.g., by the descriptor cache in RNTupleReader.
685 std::uint64_t fGeneration = 0;
686
687 std::unordered_map<ROOT::DescriptorId_t, RClusterGroupDescriptor> fClusterGroupDescriptors;
688 /// References cluster groups sorted by entry range and thus allows for binary search.
689 /// Note that this list is empty during the descriptor building process and will only be
690 /// created when the final descriptor is extracted from the builder.
691 std::vector<ROOT::DescriptorId_t> fSortedClusterGroupIds;
692 /// Potentially a subset of all the available clusters
693 std::unordered_map<ROOT::DescriptorId_t, RClusterDescriptor> fClusterDescriptors;
694
695 // We don't expose this publicly because when we add sharded clusters, this interface does not make sense anymore
697
698 /// Creates a descriptor containing only the schema information about this RNTuple, i.e. all the information needed
699 /// to create a new RNTuple with the same schema as this one but not necessarily the same clustering. This is used
700 /// when merging two RNTuples.
702
703public:
704 static constexpr unsigned int kFeatureFlagTest = 137; // Bit reserved for forward-compatibility testing
705
711
712 /// Modifiers passed to CreateModel()
714 private:
715 /// If set to true, projected fields will be reconstructed as such. This will prevent the model to be used
716 /// with an RNTupleReader, but it is useful, e.g., to accurately merge data.
718 /// By default, creating a model will fail if any of the reconstructed fields contains an unknown column type
719 /// or an unknown field structural role.
720 /// If this option is enabled, the model will be created and all fields containing unknown data (directly
721 /// or indirectly) will be skipped instead.
722 bool fForwardCompatible = false;
723 /// If true, the model will be created without a default entry (bare model).
724 bool fCreateBare = false;
725 /// If true, fields with a user defined type that have no available dictionaries will be reconstructed
726 /// as record fields from the on-disk information; otherwise, they will cause an error.
728
729 public:
730 RCreateModelOptions() {} // Work around compiler bug, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88165
731
734
737
738 void SetCreateBare(bool v) { fCreateBare = v; }
739 bool GetCreateBare() const { return fCreateBare; }
740
743 };
744
745 RNTupleDescriptor() = default;
750
751 RNTupleDescriptor Clone() const;
752
753 bool operator==(const RNTupleDescriptor &other) const;
754
755 std::uint64_t GetOnDiskHeaderXxHash3() const { return fOnDiskHeaderXxHash3; }
756 std::uint64_t GetOnDiskHeaderSize() const { return fOnDiskHeaderSize; }
757 std::uint64_t GetOnDiskFooterSize() const { return fOnDiskFooterSize; }
758
775
776 RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const;
777 RFieldDescriptorIterable
779 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
780 RFieldDescriptorIterable GetFieldIterable(ROOT::DescriptorId_t fieldId) const;
781 RFieldDescriptorIterable
783 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
784
785 RFieldDescriptorIterable GetTopLevelFields() const;
786 RFieldDescriptorIterable
787 GetTopLevelFields(const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
788
789 RColumnDescriptorIterable GetColumnIterable() const;
790 RColumnDescriptorIterable GetColumnIterable(const RFieldDescriptor &fieldDesc) const;
791 RColumnDescriptorIterable GetColumnIterable(ROOT::DescriptorId_t fieldId) const;
792
793 RClusterGroupDescriptorIterable GetClusterGroupIterable() const;
794
795 RClusterDescriptorIterable GetClusterIterable() const;
796
797 RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const;
798
799 const std::string &GetName() const { return fName; }
800 const std::string &GetDescription() const { return fDescription; }
801
802 std::size_t GetNFields() const { return fFieldDescriptors.size(); }
803 std::size_t GetNLogicalColumns() const { return fColumnDescriptors.size(); }
804 std::size_t GetNPhysicalColumns() const { return fNPhysicalColumns; }
805 std::size_t GetNClusterGroups() const { return fClusterGroupDescriptors.size(); }
806 std::size_t GetNClusters() const { return fNClusters; }
807 std::size_t GetNActiveClusters() const { return fClusterDescriptors.size(); }
808 std::size_t GetNExtraTypeInfos() const { return fExtraTypeInfoDescriptors.size(); }
809
810 /// We know the number of entries from adding the cluster summaries
813
814 /// Returns the logical parent of all top-level RNTuple data fields.
818 /// Searches for a top-level field
819 ROOT::DescriptorId_t FindFieldId(std::string_view fieldName) const;
821 std::uint16_t representationIndex) const;
823 std::uint16_t representationIndex) const;
827
828 /// Walks up the parents of the field ID and returns a field name of the form a.b.c.d
829 /// In case of invalid field ID, an empty string is returned.
831
832 /// Adjust the type name of the passed RFieldDescriptor for comparison with another renormalized type name.
833 std::string GetTypeNameForComparison(const RFieldDescriptor &fieldDesc) const;
834
835 bool HasFeature(unsigned int flag) const { return fFeatureFlags.count(flag) > 0; }
836 std::vector<std::uint64_t> GetFeatureFlags() const;
837
838 /// Return header extension information; if the descriptor does not have a header extension, return `nullptr`
839 const RHeaderExtension *GetHeaderExtension() const { return fHeaderExtension.get(); }
840
841 /// Methods to load and drop cluster group details (cluster IDs and page locations)
845
846 std::uint64_t GetGeneration() const { return fGeneration; }
848
849 /// Re-create the C++ model from the stored metadata
850 std::unique_ptr<ROOT::RNTupleModel> CreateModel(const RCreateModelOptions &options = RCreateModelOptions()) const;
851 void PrintInfo(std::ostream &output) const;
852};
853
854// clang-format off
855/**
856\class ROOT::RNTupleDescriptor::RColumnDescriptorIterable
857\ingroup NTuple
858\brief Used to loop over a field's associated columns
859*/
860// clang-format on
862private:
863 /// The associated RNTuple for this range.
865 /// The descriptor ids of the columns ordered by field, representation, and column index
866 std::vector<ROOT::DescriptorId_t> fColumns = {};
867
868public:
870 private:
871 /// The enclosing range's RNTuple.
873 /// The enclosing range's descriptor id list.
874 const std::vector<ROOT::DescriptorId_t> &fColumns;
875 std::size_t fIndex = 0;
876
877 public:
878 using iterator_category = std::forward_iterator_tag;
881 using difference_type = std::ptrdiff_t;
882 using pointer = const RColumnDescriptor *;
884
885 RIterator(const RNTupleDescriptor &ntuple, const std::vector<ROOT::DescriptorId_t> &columns, std::size_t index)
887 {
888 }
890 {
891 ++fIndex;
892 return *this;
893 }
894 reference operator*() { return fNTuple.GetColumnDescriptor(fColumns.at(fIndex)); }
895 pointer operator->() { return &fNTuple.GetColumnDescriptor(fColumns.at(fIndex)); }
896 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
897 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
898 };
899
902
905 size_t size() { return fColumns.size(); }
906};
907
908// clang-format off
909/**
910\class ROOT::RNTupleDescriptor::RFieldDescriptorIterable
911\ingroup NTuple
912\brief Used to loop over a field's child fields
913*/
914// clang-format on
916private:
917 /// The associated RNTuple for this range.
919 /// The descriptor IDs of the child fields. These may be sorted using
920 /// a comparison function.
921 std::vector<ROOT::DescriptorId_t> fFieldChildren = {};
922
923public:
925 private:
926 /// The enclosing range's RNTuple.
928 /// The enclosing range's descriptor id list.
929 const std::vector<ROOT::DescriptorId_t> &fFieldChildren;
930 std::size_t fIndex = 0;
931
932 public:
933 using iterator_category = std::forward_iterator_tag;
936 using difference_type = std::ptrdiff_t;
939
940 RIterator(const RNTupleDescriptor &ntuple, const std::vector<ROOT::DescriptorId_t> &fieldChildren,
941 std::size_t index)
943 {
944 }
946 {
947 ++fIndex;
948 return *this;
949 }
950 reference operator*() { return fNTuple.GetFieldDescriptor(fFieldChildren.at(fIndex)); }
951 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
952 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
953 };
958 /// Sort the range using an arbitrary comparison function.
960 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator)
961 : fNTuple(ntuple), fFieldChildren(field.GetLinkIds())
962 {
963 std::sort(fFieldChildren.begin(), fFieldChildren.end(), comparator);
964 }
967};
968
969// clang-format off
970/**
971\class ROOT::RNTupleDescriptor::RClusterGroupDescriptorIterable
972\ingroup NTuple
973\brief Used to loop over all the cluster groups of an RNTuple (in unspecified order)
974
975Enumerate all cluster group IDs from the descriptor. No specific order can be assumed.
976*/
977// clang-format on
979private:
980 /// The associated RNTuple for this range.
982
983public:
985 private:
986 /// The enclosing range's RNTuple.
988 std::size_t fIndex = 0;
989
990 public:
991 using iterator_category = std::forward_iterator_tag;
994 using difference_type = std::ptrdiff_t;
997
1000 {
1001 ++fIndex;
1002 return *this;
1003 }
1005 {
1006 auto it = fNTuple.fClusterGroupDescriptors.begin();
1007 std::advance(it, fIndex);
1008 return it->second;
1009 }
1010 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
1011 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
1012 };
1013
1016 RIterator end() { return RIterator(fNTuple, fNTuple.GetNClusterGroups()); }
1017};
1018
1019// clang-format off
1020/**
1021\class ROOT::RNTupleDescriptor::RClusterDescriptorIterable
1022\ingroup NTuple
1023\brief Used to loop over all the clusters of an RNTuple (in unspecified order)
1024
1025Enumerate all cluster IDs from all cluster descriptors. No specific order can be assumed, use
1026RNTupleDescriptor::FindNextClusterId() and RNTupleDescriptor::FindPrevClusterId() to traverse
1027clusters by entry number.
1028*/
1029// clang-format on
1031private:
1032 /// The associated RNTuple for this range.
1034
1035public:
1037 private:
1038 /// The enclosing range's RNTuple.
1040 std::size_t fIndex = 0;
1041
1042 public:
1043 using iterator_category = std::forward_iterator_tag;
1046 using difference_type = std::ptrdiff_t;
1049
1052 {
1053 ++fIndex;
1054 return *this;
1055 }
1057 {
1058 auto it = fNTuple.fClusterDescriptors.begin();
1059 std::advance(it, fIndex);
1060 return it->second;
1061 }
1062 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
1063 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
1064 };
1065
1068 RIterator end() { return RIterator(fNTuple, fNTuple.GetNActiveClusters()); }
1069};
1070
1071// clang-format off
1072/**
1073\class ROOT::RNTupleDescriptor::RExtraTypeInfoDescriptorIterable
1074\ingroup NTuple
1075\brief Used to loop over all the extra type info record of an RNTuple (in unspecified order)
1076*/
1077// clang-format on
1079private:
1080 /// The associated RNTuple for this range.
1082
1083public:
1085 private:
1086 /// The enclosing range's RNTuple.
1088 std::size_t fIndex = 0;
1089
1090 public:
1091 using iterator_category = std::forward_iterator_tag;
1094 using difference_type = std::ptrdiff_t;
1097
1100 {
1101 ++fIndex;
1102 return *this;
1103 }
1105 {
1106 auto it = fNTuple.fExtraTypeInfoDescriptors.begin();
1107 std::advance(it, fIndex);
1108 return *it;
1109 }
1110 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
1111 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
1112 };
1113
1116 RIterator end() { return RIterator(fNTuple, fNTuple.GetNExtraTypeInfos()); }
1117};
1118
1119// clang-format off
1120/**
1121\class ROOT::RNTupleDescriptor::RHeaderExtension
1122\ingroup NTuple
1123\brief Summarizes information about fields and the corresponding columns that were added after the header has been serialized
1124*/
1125// clang-format on
1128
1129private:
1130 /// All field IDs of late model extensions, in the order of field addition. This is necessary to serialize the
1131 /// the fields in that order.
1132 std::vector<ROOT::DescriptorId_t> fFieldIdsOrder;
1133 /// All field IDs of late model extensions for efficient lookup. When a column gets added to the extension
1134 /// header, this enables us to determine if the column belongs to a field of the header extension of if it
1135 /// belongs to a field of the regular header that gets extended by additional column representations.
1136 std::unordered_set<ROOT::DescriptorId_t> fFieldIdsLookup;
1137 /// All logical column IDs of columns that extend, with additional column representations, fields of the regular
1138 /// header. During serialization, these columns are not picked up as columns of `fFieldIdsOrder`. But instead
1139 /// these columns need to be serialized in the extension header without re-serializing the field.
1140 std::vector<ROOT::DescriptorId_t> fExtendedColumnRepresentations;
1141 /// Number of logical and physical columns; updated by the descriptor builder when columns are added
1142 std::uint32_t fNLogicalColumns = 0;
1143 std::uint32_t fNPhysicalColumns = 0;
1144
1145 /// Marks `fieldDesc` as an extended field, i.e. a field that appears in the Header Extension (e.g. having been added
1146 /// through late model extension). Note that the field descriptor should also have been added to the RNTuple
1147 /// Descriptor alongside non-extended fields.
1149 {
1150 fFieldIdsOrder.emplace_back(fieldDesc.GetId());
1151 fFieldIdsLookup.insert(fieldDesc.GetId());
1152 }
1153
1154 /// Marks `columnDesc` as an extended column, i.e. a column that appears in the Header Extension (e.g. having been
1155 /// added through late model extension as an additional representation of an existing column). Note that the column
1156 /// descriptor should also have been added to the RNTuple Descriptor alongside non-extended columns.
1158 {
1160 if (!columnDesc.IsAliasColumn())
1162 if (fFieldIdsLookup.count(columnDesc.GetFieldId()) == 0) {
1163 fExtendedColumnRepresentations.emplace_back(columnDesc.GetLogicalId());
1164 }
1165 }
1166
1167public:
1168 std::size_t GetNFields() const { return fFieldIdsOrder.size(); }
1169 std::size_t GetNLogicalColumns() const { return fNLogicalColumns; }
1170 std::size_t GetNPhysicalColumns() const { return fNPhysicalColumns; }
1171 const std::vector<ROOT::DescriptorId_t> &GetExtendedColumnRepresentations() const
1172 {
1174 }
1175 /// Return a vector containing the IDs of the top-level fields defined in the extension header, in the order
1176 /// of their addition.
1177 /// We cannot create this vector when building the fFields because at the time when AddExtendedField is called,
1178 /// the field is not yet linked into the schema tree.
1179 std::vector<ROOT::DescriptorId_t> GetTopLevelFields(const RNTupleDescriptor &desc) const;
1180
1182 {
1183 return fFieldIdsLookup.find(fieldId) != fFieldIdsLookup.end();
1184 }
1190};
1191
1192namespace Internal {
1193
1194// clang-format off
1195/**
1196\class ROOT::Internal::RColumnDescriptorBuilder
1197\ingroup NTuple
1198\brief A helper class for piece-wise construction of an RColumnDescriptor
1199
1200Dangling column descriptors can become actual descriptors when added to an
1201RNTupleDescriptorBuilder instance and then linked to their fields.
1202*/
1203// clang-format on
1205private:
1207
1208public:
1209 /// Make an empty column descriptor builder.
1211
1223 {
1225 return *this;
1226 }
1228 {
1229 fColumn.fType = type;
1230 return *this;
1231 }
1238 {
1240 return *this;
1241 }
1259 RColumnDescriptorBuilder &ValueRange(double min, double max)
1260 {
1261 fColumn.fValueRange = {min, max};
1262 return *this;
1263 }
1264 RColumnDescriptorBuilder &ValueRange(std::optional<RColumnDescriptor::RValueRange> valueRange)
1265 {
1267 return *this;
1268 }
1271 /// Attempt to make a column descriptor. This may fail if the column
1272 /// was not given enough information to make a proper descriptor.
1274};
1275
1276// clang-format off
1277/**
1278\class ROOT::Internal::RFieldDescriptorBuilder
1279\ingroup NTuple
1280\brief A helper class for piece-wise construction of an RFieldDescriptor
1281
1282Dangling field descriptors describe a single field in isolation. They are
1283missing the necessary relationship information (parent field, any child fields)
1284required to describe a real RNTuple field.
1285
1286Dangling field descriptors can only become actual descriptors when added to an
1287RNTupleDescriptorBuilder instance and then linked to other fields.
1288*/
1289// clang-format on
1291private:
1293
1294public:
1295 /// Make an empty dangling field descriptor.
1297 /// Make a new RFieldDescriptorBuilder based off an existing descriptor.
1298 /// Relationship information is lost during the conversion to a
1299 /// dangling descriptor:
1300 /// * Parent id is reset to an invalid id.
1301 /// * Field children ids are forgotten.
1302 ///
1303 /// These properties must be set using RNTupleDescriptorBuilder::AddFieldLink().
1305
1306 /// Make a new RFieldDescriptorBuilder based off a live RNTuple field.
1308
1315 {
1317 return *this;
1318 }
1320 {
1322 return *this;
1323 }
1325 {
1327 return *this;
1328 }
1335 {
1337 return *this;
1338 }
1340 {
1342 return *this;
1343 }
1344 RFieldDescriptorBuilder &TypeName(const std::string &typeName)
1345 {
1346 fField.fTypeName = typeName;
1347 return *this;
1348 }
1350 {
1352 return *this;
1353 }
1355 {
1357 return *this;
1358 }
1360 {
1361 fField.fStructure = structure;
1362 return *this;
1363 }
1364 RFieldDescriptorBuilder &TypeChecksum(const std::optional<std::uint32_t> typeChecksum)
1365 {
1367 return *this;
1368 }
1370 /// Attempt to make a field descriptor. This may fail if the dangling field
1371 /// was not given enough information to make a proper descriptor.
1373};
1374
1375// clang-format off
1376/**
1377\class ROOT::Internal::RClusterDescriptorBuilder
1378\ingroup NTuple
1379\brief A helper class for piece-wise construction of an RClusterDescriptor
1380
1381The cluster descriptor builder starts from a summary-only cluster descriptor and allows for the
1382piecewise addition of page locations.
1383*/
1384// clang-format on
1386private:
1388
1389public:
1395
1401
1403 {
1405 return *this;
1406 }
1407
1410
1411 /// Books the given column ID as being suppressed in this cluster. The correct first element index and number of
1412 /// elements need to be set by CommitSuppressedColumnRanges() once all the calls to CommitColumnRange() and
1413 /// MarkSuppressedColumnRange() took place.
1415
1416 /// Sets the first element index and number of elements for all the suppressed column ranges.
1417 /// The information is taken from the corresponding columns from the primary representation.
1418 /// Needs to be called when all the columns (suppressed and regular) where added.
1420
1421 /// Add column and page ranges for columns created during late model extension missing in this cluster. The locator
1422 /// type for the synthesized page ranges is `kTypePageZero`. All the page sources must be able to populate the
1423 /// 'zero' page from such locator. Any call to CommitColumnRange() and CommitSuppressedColumnRanges()
1424 /// should happen before calling this function.
1426
1431
1432 /// Move out the full cluster descriptor including page locations
1434};
1435
1436// clang-format off
1437/**
1438\class ROOT::Internal::RClusterGroupDescriptorBuilder
1439\ingroup NTuple
1440\brief A helper class for piece-wise construction of an RClusterGroupDescriptor
1441*/
1442// clang-format on
1444private:
1446
1447public:
1450
1467 {
1469 return *this;
1470 }
1472 {
1474 return *this;
1475 }
1477 {
1479 return *this;
1480 }
1481 void AddSortedClusters(const std::vector<ROOT::DescriptorId_t> &clusterIds)
1482 {
1483 if (clusterIds.size() != fClusterGroup.GetNClusters())
1484 throw RException(R__FAIL("mismatch of number of clusters"));
1486 }
1487
1489};
1490
1491// clang-format off
1492/**
1493\class ROOT::Internal::RExtraTypeInfoDescriptorBuilder
1494\ingroup NTuple
1495\brief A helper class for piece-wise construction of an RExtraTypeInfoDescriptor
1496*/
1497// clang-format on
1499private:
1501
1502public:
1504
1511 {
1513 return *this;
1514 }
1515 RExtraTypeInfoDescriptorBuilder &TypeName(const std::string &typeName)
1516 {
1517 fExtraTypeInfo.fTypeName = typeName;
1518 return *this;
1519 }
1521 {
1523 return *this;
1524 }
1525
1527};
1528
1529// clang-format off
1530/**
1531\class ROOT::Internal::RNTupleDescriptorBuilder
1532\ingroup NTuple
1533\brief A helper class for piece-wise construction of an RNTupleDescriptor
1534
1535Used by RPageStorage implementations in order to construct the RNTupleDescriptor from the various header parts.
1536*/
1537// clang-format on
1539private:
1542
1543public:
1544 /// Checks whether invariants hold:
1545 /// * RNTuple epoch is valid
1546 /// * RNTuple name is valid
1547 /// * Fields have valid parents
1548 /// * Number of columns is constant across column representations
1552
1553 /// Copies the "schema" part of `descriptor` into the builder's descriptor.
1554 /// This resets the builder's descriptor.
1556
1557 void SetVersion(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor,
1558 std::uint16_t versionPatch);
1559 void SetVersionForWriting();
1560
1561 void SetNTuple(const std::string_view name, const std::string_view description);
1562 void SetFeature(unsigned int flag);
1563
1566 /// The real footer size also include the page list envelopes
1568
1569 void AddField(const RFieldDescriptor &fieldDesc);
1572
1573 // The field that the column belongs to has to be already available. For fields with multiple columns,
1574 // the columns need to be added in order of the column index
1576
1579
1582
1583 /// Clears so-far stored clusters, fields, and columns and return to a pristine RNTupleDescriptor
1584 void Reset();
1585
1586 /// Mark the beginning of the header extension; any fields and columns added after a call to this function are
1587 /// annotated as begin part of the header extension.
1588 void BeginHeaderExtension();
1589
1590 /// \brief Shift column IDs of alias columns by `offset`
1591 ///
1592 /// If the descriptor is constructed in pieces consisting of physical and alias columns
1593 /// (regular and projected fields), the natural column order would be
1594 /// - Physical and alias columns of piece one
1595 /// - Physical and alias columns of piece two
1596 /// - etc.
1597 /// What we want, however, are first all physical column IDs and then all alias column IDs.
1598 /// This method adds `offset` to the logical column IDs of all alias columns and fixes up the corresponding
1599 /// column IDs in the projected field descriptors. In this way, a new piece of physical and alias columns can
1600 /// first shift the existing alias columns by the number of new physical columns, resulting in the following order
1601 /// - Physical columns of piece one
1602 /// - Physical columns of piece two
1603 /// - ...
1604 // - Logical columns of piece one
1605 /// - Logical columns of piece two
1606 /// - ...
1607 void ShiftAliasColumns(std::uint32_t offset);
1608
1609 /// Get the streamer info records for custom classes. Currently requires the corresponding dictionaries to be loaded.
1611};
1612
1614{
1615 return desc.CloneSchema();
1616}
1617
1618} // namespace Internal
1619} // namespace ROOT
1620
1621#endif // ROOT_RNTupleDescriptor
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:300
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
The available trivial, native content types of a column.
A helper class for piece-wise construction of an RClusterDescriptor.
RResult< void > MarkSuppressedColumnRange(ROOT::DescriptorId_t physicalId)
Books the given column ID as being suppressed in this cluster.
RResult< void > CommitColumnRange(ROOT::DescriptorId_t physicalId, std::uint64_t firstElementIndex, std::uint32_t compressionSettings, const RClusterDescriptor::RPageRange &pageRange)
RClusterDescriptorBuilder & AddExtendedColumnRanges(const RNTupleDescriptor &desc)
Add column and page ranges for columns created during late model extension missing in this cluster.
RClusterDescriptorBuilder & NEntries(std::uint64_t nEntries)
RResult< void > CommitSuppressedColumnRanges(const RNTupleDescriptor &desc)
Sets the first element index and number of elements for all the suppressed column ranges.
RResult< RClusterDescriptor > MoveDescriptor()
Move out the full cluster descriptor including page locations.
const RClusterDescriptor::RColumnRange & GetColumnRange(ROOT::DescriptorId_t physicalId)
RClusterDescriptorBuilder & ClusterId(ROOT::DescriptorId_t clusterId)
RClusterDescriptorBuilder & FirstEntryIndex(std::uint64_t firstEntryIndex)
A helper class for piece-wise construction of an RClusterGroupDescriptor.
RClusterGroupDescriptorBuilder & EntrySpan(std::uint64_t entrySpan)
RClusterGroupDescriptorBuilder & PageListLocator(const RNTupleLocator &pageListLocator)
static RClusterGroupDescriptorBuilder FromSummary(const RClusterGroupDescriptor &clusterGroupDesc)
RClusterGroupDescriptorBuilder & PageListLength(std::uint64_t pageListLength)
RClusterGroupDescriptorBuilder & MinEntry(std::uint64_t minEntry)
void AddSortedClusters(const std::vector< ROOT::DescriptorId_t > &clusterIds)
RResult< RClusterGroupDescriptor > MoveDescriptor()
RClusterGroupDescriptorBuilder & ClusterGroupId(ROOT::DescriptorId_t clusterGroupId)
RClusterGroupDescriptorBuilder & NClusters(std::uint32_t nClusters)
A helper class for piece-wise construction of an RColumnDescriptor.
ROOT::DescriptorId_t GetRepresentationIndex() const
RColumnDescriptorBuilder & SetSuppressedDeferred()
RColumnDescriptorBuilder & LogicalColumnId(ROOT::DescriptorId_t logicalColumnId)
RResult< RColumnDescriptor > MakeDescriptor() const
Attempt to make a column descriptor.
RColumnDescriptorBuilder & FieldId(ROOT::DescriptorId_t fieldId)
RColumnDescriptorBuilder & BitsOnStorage(std::uint16_t bitsOnStorage)
RColumnDescriptorBuilder & ValueRange(double min, double max)
RColumnDescriptorBuilder()=default
Make an empty column descriptor builder.
RColumnDescriptorBuilder & ValueRange(std::optional< RColumnDescriptor::RValueRange > valueRange)
RColumnDescriptorBuilder & Type(ROOT::ENTupleColumnType type)
RColumnDescriptorBuilder & PhysicalColumnId(ROOT::DescriptorId_t physicalColumnId)
RColumnDescriptorBuilder & FirstElementIndex(std::uint64_t firstElementIdx)
RColumnDescriptorBuilder & Index(std::uint32_t index)
RColumnDescriptorBuilder & RepresentationIndex(std::uint16_t representationIndex)
A column element encapsulates the translation between basic C++ types and their column representation...
A helper class for piece-wise construction of an RExtraTypeInfoDescriptor.
RResult< RExtraTypeInfoDescriptor > MoveDescriptor()
RExtraTypeInfoDescriptorBuilder & ContentId(EExtraTypeInfoIds contentId)
RExtraTypeInfoDescriptorBuilder & TypeName(const std::string &typeName)
RExtraTypeInfoDescriptorBuilder & Content(const std::string &content)
RExtraTypeInfoDescriptorBuilder & TypeVersion(std::uint32_t typeVersion)
A helper class for piece-wise construction of an RFieldDescriptor.
RFieldDescriptorBuilder & NRepetitions(std::uint64_t nRepetitions)
RFieldDescriptorBuilder & Structure(const ROOT::ENTupleStructure &structure)
RFieldDescriptorBuilder()=default
Make an empty dangling field descriptor.
RFieldDescriptorBuilder & TypeAlias(const std::string &typeAlias)
RFieldDescriptorBuilder & ProjectionSourceId(ROOT::DescriptorId_t id)
RFieldDescriptorBuilder & TypeVersion(std::uint32_t typeVersion)
RFieldDescriptorBuilder & TypeChecksum(const std::optional< std::uint32_t > typeChecksum)
RResult< RFieldDescriptor > MakeDescriptor() const
Attempt to make a field descriptor.
RFieldDescriptorBuilder & ParentId(ROOT::DescriptorId_t id)
static RFieldDescriptorBuilder FromField(const ROOT::RFieldBase &field)
Make a new RFieldDescriptorBuilder based off a live RNTuple field.
RFieldDescriptorBuilder & FieldDescription(const std::string &fieldDescription)
RFieldDescriptorBuilder & FieldVersion(std::uint32_t fieldVersion)
RFieldDescriptorBuilder & FieldName(const std::string &fieldName)
RFieldDescriptorBuilder & FieldId(ROOT::DescriptorId_t fieldId)
RFieldDescriptorBuilder & TypeName(const std::string &typeName)
A helper class for piece-wise construction of an RNTupleDescriptor.
void SetNTuple(const std::string_view name, const std::string_view description)
void SetSchemaFromExisting(const RNTupleDescriptor &descriptor)
Copies the "schema" part of descriptor into the builder's descriptor.
RResult< void > AddColumn(RColumnDescriptor &&columnDesc)
RResult< void > AddFieldProjection(ROOT::DescriptorId_t sourceId, ROOT::DescriptorId_t targetId)
void ReplaceExtraTypeInfo(RExtraTypeInfoDescriptor &&extraTypeInfoDesc)
RResult< void > AddExtraTypeInfo(RExtraTypeInfoDescriptor &&extraTypeInfoDesc)
void ShiftAliasColumns(std::uint32_t offset)
Shift column IDs of alias columns by offset
void SetVersion(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor, std::uint16_t versionPatch)
const RNTupleDescriptor & GetDescriptor() const
void BeginHeaderExtension()
Mark the beginning of the header extension; any fields and columns added after a call to this functio...
RResult< void > AddCluster(RClusterDescriptor &&clusterDesc)
RResult< void > EnsureValidDescriptor() const
Checks whether invariants hold:
RResult< void > AddFieldLink(ROOT::DescriptorId_t fieldId, ROOT::DescriptorId_t linkId)
void Reset()
Clears so-far stored clusters, fields, and columns and return to a pristine RNTupleDescriptor.
void AddField(const RFieldDescriptor &fieldDesc)
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t BuildStreamerInfos() const
Get the streamer info records for custom classes. Currently requires the corresponding dictionaries t...
RResult< void > AddClusterGroup(RClusterGroupDescriptor &&clusterGroup)
void SetOnDiskHeaderXxHash3(std::uint64_t xxhash3)
RResult< void > EnsureFieldExists(ROOT::DescriptorId_t fieldId) const
void AddToOnDiskFooterSize(std::uint64_t size)
The real footer size also include the page list envelopes.
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
std::unordered_map< ROOT::DescriptorId_t, RColumnRange >::const_iterator Iter_t
RColumnRangeIterable(const RClusterDescriptor &desc)
The window of element indexes of a particular column in a particular cluster.
void SetCompressionSettings(std::optional< std::uint32_t > comp)
bool fIsSuppressed
Suppressed columns have an empty page range and unknown compression settings.
void SetPhysicalColumnId(ROOT::DescriptorId_t id)
ROOT::DescriptorId_t GetPhysicalColumnId() const
bool operator==(const RColumnRange &other) const
void SetFirstElementIndex(ROOT::NTupleSize_t idx)
ROOT::NTupleSize_t fFirstElementIndex
The global index of the first column element in the cluster.
std::optional< std::uint32_t > GetCompressionSettings() const
std::optional< std::uint32_t > fCompressionSettings
The usual format for ROOT compression settings (see Compression.h).
ROOT::NTupleSize_t GetFirstElementIndex() const
RColumnRange(ROOT::DescriptorId_t physicalColumnId, ROOT::NTupleSize_t firstElementIndex, ROOT::NTupleSize_t nElements, std::optional< std::uint32_t > compressionSettings, bool suppressed=false)
void IncrementFirstElementIndex(ROOT::NTupleSize_t by)
bool Contains(ROOT::NTupleSize_t index) const
ROOT::NTupleSize_t fNElements
The number of column elements in the cluster.
void IncrementNElements(ROOT::NTupleSize_t by)
Records the partition of data into pages for a particular column in a particular cluster.
RPageRange & operator=(const RPageRange &other)=delete
RPageRange(RPageRange &&other)=default
RPageRange(const RPageRange &other)=delete
const std::vector< RPageInfo > & GetPageInfos() const
RPageInfoExtended Find(ROOT::NTupleSize_t idxInCluster) const
Find the page in the RPageRange that contains the given element. The element must exist.
std::vector< ROOT::NTupleSize_t > fCumulativeNElements
Has the same length than fPageInfos and stores the sum of the number of elements of all the pages up ...
bool operator==(const RPageRange &other) const
ROOT::DescriptorId_t GetPhysicalColumnId() const
void SetPhysicalColumnId(ROOT::DescriptorId_t id)
std::size_t ExtendToFitColumnRange(const RColumnRange &columnRange, const ROOT::Internal::RColumnElementBase &element, std::size_t pageSize)
Extend this RPageRange to fit the given RColumnRange.
RPageRange & operator=(RPageRange &&other)=default
std::vector< RPageInfo > & GetPageInfos()
Metadata for RNTuple clusters.
ROOT::NTupleSize_t GetNEntries() const
ROOT::NTupleSize_t fFirstEntryIndex
Clusters can be swapped by adjusting the entry offsets of the cluster and all ranges.
RClusterDescriptor & operator=(const RClusterDescriptor &other)=delete
ROOT::DescriptorId_t GetId() const
const RPageRange & GetPageRange(ROOT::DescriptorId_t physicalId) const
RClusterDescriptor(RClusterDescriptor &&other)=default
std::unordered_map< ROOT::DescriptorId_t, RColumnRange > fColumnRanges
ROOT::DescriptorId_t fClusterId
bool ContainsColumn(ROOT::DescriptorId_t physicalId) const
RClusterDescriptor & operator=(RClusterDescriptor &&other)=default
RClusterDescriptor Clone() const
bool operator==(const RClusterDescriptor &other) const
const RColumnRange & GetColumnRange(ROOT::DescriptorId_t physicalId) const
RColumnRangeIterable GetColumnRangeIterable() const
Returns an iterator over pairs { columnId, columnRange }. The iteration order is unspecified.
ROOT::NTupleSize_t GetFirstEntryIndex() const
std::unordered_map< ROOT::DescriptorId_t, RPageRange > fPageRanges
RClusterDescriptor(const RClusterDescriptor &other)=delete
std::uint64_t GetNBytesOnStorage() const
Clusters are bundled in cluster groups.
RNTupleLocator fPageListLocator
The page list that corresponds to the cluster group.
RClusterGroupDescriptor & operator=(const RClusterGroupDescriptor &other)=delete
RClusterGroupDescriptor Clone() const
std::vector< ROOT::DescriptorId_t > fClusterIds
The cluster IDs can be empty if the corresponding page list is not loaded.
ROOT::DescriptorId_t GetId() const
RClusterGroupDescriptor(RClusterGroupDescriptor &&other)=default
std::uint64_t fMinEntry
The minimum first entry number of the clusters in the cluster group.
bool HasClusterDetails() const
A cluster group is loaded in two stages.
std::uint32_t fNClusters
Number of clusters is always known even if the cluster IDs are not (yet) populated.
RClusterGroupDescriptor & operator=(RClusterGroupDescriptor &&other)=default
const std::vector< ROOT::DescriptorId_t > & GetClusterIds() const
std::uint64_t fPageListLength
Uncompressed size of the page list.
std::uint64_t GetPageListLength() const
RNTupleLocator GetPageListLocator() const
RClusterGroupDescriptor(const RClusterGroupDescriptor &other)=delete
std::uint64_t fEntrySpan
Number of entries that are (partially for sharded clusters) covered by this cluster group.
bool operator==(const RClusterGroupDescriptor &other) const
RClusterGroupDescriptor CloneSummary() const
Creates a clone without the cluster IDs.
Metadata stored for every column of an RNTuple.
std::optional< RValueRange > GetValueRange() const
ROOT::DescriptorId_t fPhysicalColumnId
Usually identical to the logical column ID, except for alias columns where it references the shadowed...
bool operator==(const RColumnDescriptor &other) const
ROOT::DescriptorId_t fLogicalColumnId
The actual column identifier, which is the link to the corresponding field.
RColumnDescriptor(const RColumnDescriptor &other)=delete
std::uint64_t GetFirstElementIndex() const
ROOT::DescriptorId_t fFieldId
Every column belongs to one and only one field.
std::int64_t fFirstElementIndex
The absolute value specifies the index for the first stored element for this column.
ROOT::DescriptorId_t GetFieldId() const
RColumnDescriptor(RColumnDescriptor &&other)=default
std::uint32_t fIndex
A field can be serialized into several columns, which are numbered from zero to $n$.
RColumnDescriptor & operator=(RColumnDescriptor &&other)=default
std::uint32_t GetIndex() const
std::uint16_t fBitsOnStorage
The size in bits of elements of this column.
std::uint16_t fRepresentationIndex
A field may use multiple column representations, which are numbered from zero to $m$.
ROOT::ENTupleColumnType fType
The on-disk column type.
ROOT::ENTupleColumnType GetType() const
ROOT::DescriptorId_t GetPhysicalId() const
std::uint16_t GetRepresentationIndex() const
std::optional< RValueRange > fValueRange
Optional value range (used e.g. by quantized real fields)
std::uint16_t GetBitsOnStorage() const
RColumnDescriptor Clone() const
Get a copy of the descriptor.
RColumnDescriptor & operator=(const RColumnDescriptor &other)=delete
ROOT::DescriptorId_t GetLogicalId() const
Base class for all ROOT issued exceptions.
Definition RError.hxx:79
Field specific extra type information from the header / extenstion header.
RExtraTypeInfoDescriptor & operator=(RExtraTypeInfoDescriptor &&other)=default
RExtraTypeInfoDescriptor & operator=(const RExtraTypeInfoDescriptor &other)=delete
bool operator==(const RExtraTypeInfoDescriptor &other) const
RExtraTypeInfoDescriptor Clone() const
RExtraTypeInfoDescriptor(const RExtraTypeInfoDescriptor &other)=delete
EExtraTypeInfoIds fContentId
Specifies the meaning of the extra information.
std::string fTypeName
The type name the extra information refers to; empty for RNTuple-wide extra information.
std::string fContent
The content format depends on the content ID and may be binary.
const std::string & GetContent() const
const std::string & GetTypeName() const
RExtraTypeInfoDescriptor(RExtraTypeInfoDescriptor &&other)=default
EExtraTypeInfoIds GetContentId() const
std::uint32_t fTypeVersion
Type version the extra type information is bound to.
A field translates read and write calls from/to underlying columns to/from tree values.
Metadata stored for every field of an RNTuple.
const std::string & GetTypeAlias() const
std::unique_ptr< ROOT::RFieldBase > CreateField(const RNTupleDescriptor &ntplDesc, const ROOT::RCreateFieldOptions &options={}) const
In general, we create a field simply from the C++ type name.
std::uint32_t fFieldVersion
The version of the C++-type-to-column translation mechanics.
ROOT::DescriptorId_t fFieldId
RFieldDescriptor Clone() const
Get a copy of the descriptor.
ROOT::DescriptorId_t GetId() const
std::uint64_t fNRepetitions
The number of elements per entry for fixed-size arrays.
std::uint32_t GetFieldVersion() const
const std::vector< ROOT::DescriptorId_t > & GetLogicalColumnIds() const
std::uint32_t fColumnCardinality
The number of columns in the column representations of the field.
ROOT::DescriptorId_t fProjectionSourceId
For projected fields, the source field ID.
ROOT::ENTupleStructure GetStructure() const
bool operator==(const RFieldDescriptor &other) const
RFieldDescriptor(const RFieldDescriptor &other)=delete
std::uint32_t GetColumnCardinality() const
std::string fFieldDescription
Free text set by the user.
RFieldDescriptor & operator=(const RFieldDescriptor &other)=delete
RFieldDescriptor & operator=(RFieldDescriptor &&other)=default
const std::vector< ROOT::DescriptorId_t > & GetLinkIds() const
ROOT::DescriptorId_t fParentId
Establishes sub field relationships, such as classes and collections.
ROOT::DescriptorId_t GetParentId() const
bool IsCustomClass() const
Tells if the field describes a user-defined class rather than a fundamental type, a collection,...
std::string fTypeAlias
A typedef or using directive that resolved to the type name during field creation.
ROOT::ENTupleStructure fStructure
The structural information carried by this field in the data model tree.
std::uint64_t GetNRepetitions() const
RFieldDescriptor(RFieldDescriptor &&other)=default
std::vector< ROOT::DescriptorId_t > fLinkIds
The pointers in the other direction from parent to children.
std::string fFieldName
The leaf name, not including parent fields.
const std::string & GetFieldDescription() const
std::optional< std::uint32_t > GetTypeChecksum() const
ROOT::DescriptorId_t GetProjectionSourceId() const
std::uint32_t fTypeVersion
The version of the C++ type itself.
std::string fTypeName
The C++ type that was used when writing the field.
std::uint32_t GetTypeVersion() const
const std::string & GetFieldName() const
std::vector< ROOT::DescriptorId_t > fLogicalColumnIds
The ordered list of columns attached to this field: first by representation index then by column inde...
const std::string & GetTypeName() const
std::optional< std::uint32_t > fTypeChecksum
For custom classes, we store the ROOT TClass reported checksum to facilitate the use of I/O rules tha...
const RNTupleDescriptor & fNTuple
The enclosing range's RNTuple.
RIterator(const RNTupleDescriptor &ntuple, std::size_t index)
Used to loop over all the clusters of an RNTuple (in unspecified order)
const RNTupleDescriptor & fNTuple
The associated RNTuple for this range.
RClusterDescriptorIterable(const RNTupleDescriptor &ntuple)
RIterator(const RNTupleDescriptor &ntuple, std::size_t index)
const RNTupleDescriptor & fNTuple
The enclosing range's RNTuple.
Used to loop over all the cluster groups of an RNTuple (in unspecified order)
const RNTupleDescriptor & fNTuple
The associated RNTuple for this range.
const RNTupleDescriptor & fNTuple
The enclosing range's RNTuple.
const std::vector< ROOT::DescriptorId_t > & fColumns
The enclosing range's descriptor id list.
RIterator(const RNTupleDescriptor &ntuple, const std::vector< ROOT::DescriptorId_t > &columns, std::size_t index)
Used to loop over a field's associated columns.
const RNTupleDescriptor & fNTuple
The associated RNTuple for this range.
std::vector< ROOT::DescriptorId_t > fColumns
The descriptor ids of the columns ordered by field, representation, and column index.
RColumnDescriptorIterable(const RNTupleDescriptor &ntuple, const RFieldDescriptor &fieldDesc)
const RNTupleDescriptor & fNTuple
The enclosing range's RNTuple.
RIterator(const RNTupleDescriptor &ntuple, std::size_t index)
Used to loop over all the extra type info record of an RNTuple (in unspecified order)
const RNTupleDescriptor & fNTuple
The associated RNTuple for this range.
RIterator(const RNTupleDescriptor &ntuple, const std::vector< ROOT::DescriptorId_t > &fieldChildren, std::size_t index)
const std::vector< ROOT::DescriptorId_t > & fFieldChildren
The enclosing range's descriptor id list.
const RNTupleDescriptor & fNTuple
The enclosing range's RNTuple.
Used to loop over a field's child fields.
const RNTupleDescriptor & fNTuple
The associated RNTuple for this range.
RFieldDescriptorIterable(const RNTupleDescriptor &ntuple, const RFieldDescriptor &field, const std::function< bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator)
Sort the range using an arbitrary comparison function.
RFieldDescriptorIterable(const RNTupleDescriptor &ntuple, const RFieldDescriptor &field)
std::vector< ROOT::DescriptorId_t > fFieldChildren
The descriptor IDs of the child fields.
Summarizes information about fields and the corresponding columns that were added after the header ha...
const std::vector< ROOT::DescriptorId_t > & GetExtendedColumnRepresentations() const
std::unordered_set< ROOT::DescriptorId_t > fFieldIdsLookup
All field IDs of late model extensions for efficient lookup.
std::uint32_t fNLogicalColumns
Number of logical and physical columns; updated by the descriptor builder when columns are added.
std::vector< ROOT::DescriptorId_t > fExtendedColumnRepresentations
All logical column IDs of columns that extend, with additional column representations,...
bool ContainsExtendedColumnRepresentation(ROOT::DescriptorId_t columnId) const
void MarkExtendedField(const RFieldDescriptor &fieldDesc)
Marks fieldDesc as an extended field, i.e.
std::vector< ROOT::DescriptorId_t > fFieldIdsOrder
All field IDs of late model extensions, in the order of field addition.
bool ContainsField(ROOT::DescriptorId_t fieldId) const
void MarkExtendedColumn(const RColumnDescriptor &columnDesc)
Marks columnDesc as an extended column, i.e.
The on-storage metadata of an RNTuple.
std::uint64_t GetGeneration() const
RNTupleDescriptor(RNTupleDescriptor &&other)=default
const RClusterGroupDescriptor & GetClusterGroupDescriptor(ROOT::DescriptorId_t clusterGroupId) const
const RColumnDescriptor & GetColumnDescriptor(ROOT::DescriptorId_t columnId) const
ROOT::DescriptorId_t FindNextClusterId(ROOT::DescriptorId_t clusterId) const
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
std::set< unsigned int > fFeatureFlags
std::unordered_map< ROOT::DescriptorId_t, RClusterGroupDescriptor > fClusterGroupDescriptors
const RFieldDescriptor & GetFieldDescriptor(ROOT::DescriptorId_t fieldId) const
RNTupleDescriptor & operator=(RNTupleDescriptor &&other)=default
std::uint64_t fNPhysicalColumns
Updated by the descriptor builder when columns are added.
ROOT::DescriptorId_t fFieldZeroId
Set by the descriptor builder.
std::uint64_t fNEntries
Updated by the descriptor builder when the cluster groups are added.
std::size_t GetNExtraTypeInfos() const
std::uint64_t GetOnDiskFooterSize() const
RClusterGroupDescriptorIterable GetClusterGroupIterable() const
std::size_t GetNActiveClusters() const
RColumnDescriptorIterable GetColumnIterable() const
bool operator==(const RNTupleDescriptor &other) const
const std::string & GetName() const
std::uint64_t fOnDiskFooterSize
Like fOnDiskHeaderSize, contains both cluster summaries and page locations.
std::uint16_t fVersionMinor
Set by the descriptor builder when deserialized.
ROOT::DescriptorId_t FindClusterId(ROOT::NTupleSize_t entryIdx) const
std::vector< std::uint64_t > GetFeatureFlags() const
ROOT::NTupleSize_t GetNEntries() const
We know the number of entries from adding the cluster summaries.
ROOT::DescriptorId_t GetFieldZeroId() const
Returns the logical parent of all top-level RNTuple data fields.
std::unique_ptr< ROOT::RNTupleModel > CreateModel(const RCreateModelOptions &options=RCreateModelOptions()) const
Re-create the C++ model from the stored metadata.
std::string GetTypeNameForComparison(const RFieldDescriptor &fieldDesc) const
Adjust the type name of the passed RFieldDescriptor for comparison with another renormalized type nam...
std::unordered_map< ROOT::DescriptorId_t, RClusterDescriptor > fClusterDescriptors
Potentially a subset of all the available clusters.
std::size_t GetNClusters() const
ROOT::DescriptorId_t FindPhysicalColumnId(ROOT::DescriptorId_t fieldId, std::uint32_t columnIndex, std::uint16_t representationIndex) const
RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const
std::size_t GetNPhysicalColumns() const
const RHeaderExtension * GetHeaderExtension() const
Return header extension information; if the descriptor does not have a header extension,...
void PrintInfo(std::ostream &output) const
std::uint64_t fNClusters
Updated by the descriptor builder when the cluster groups are added.
std::uint64_t fOnDiskHeaderXxHash3
Set by the descriptor builder when deserialized.
const RClusterDescriptor & GetClusterDescriptor(ROOT::DescriptorId_t clusterId) const
ROOT::DescriptorId_t FindFieldId(std::string_view fieldName, ROOT::DescriptorId_t parentId) const
std::string fName
The RNTuple name needs to be unique in a given storage location (file)
RNTupleDescriptor(const RNTupleDescriptor &other)=delete
std::uint64_t fOnDiskHeaderSize
Set by the descriptor builder when deserialized.
std::uint64_t GetOnDiskHeaderXxHash3() const
RResult< void > DropClusterGroupDetails(ROOT::DescriptorId_t clusterGroupId)
std::uint16_t fVersionMajor
Set by the descriptor builder when deserialized.
std::vector< ROOT::DescriptorId_t > fSortedClusterGroupIds
References cluster groups sorted by entry range and thus allows for binary search.
std::unordered_map< ROOT::DescriptorId_t, RColumnDescriptor > fColumnDescriptors
ROOT::DescriptorId_t FindLogicalColumnId(ROOT::DescriptorId_t fieldId, std::uint32_t columnIndex, std::uint16_t representationIndex) const
std::unordered_map< ROOT::DescriptorId_t, RFieldDescriptor > fFieldDescriptors
std::size_t GetNFields() const
static constexpr unsigned int kFeatureFlagTest
ROOT::NTupleSize_t GetNElements(ROOT::DescriptorId_t physicalColumnId) const
RResult< void > AddClusterGroupDetails(ROOT::DescriptorId_t clusterGroupId, std::vector< RClusterDescriptor > &clusterDescs)
Methods to load and drop cluster group details (cluster IDs and page locations)
bool HasFeature(unsigned int flag) const
std::uint16_t fVersionPatch
Set by the descriptor builder when deserialized.
std::uint64_t GetOnDiskHeaderSize() const
std::string fDescription
Free text from the user.
RFieldDescriptorIterable GetTopLevelFields() const
std::uint16_t fVersionEpoch
Set by the descriptor builder when deserialized.
std::vector< RExtraTypeInfoDescriptor > fExtraTypeInfoDescriptors
RNTupleDescriptor Clone() const
std::size_t GetNLogicalColumns() const
RNTupleDescriptor & operator=(const RNTupleDescriptor &other)=delete
std::size_t GetNClusterGroups() const
std::string GetQualifiedFieldName(ROOT::DescriptorId_t fieldId) const
Walks up the parents of the field ID and returns a field name of the form a.b.c.d In case of invalid ...
RClusterDescriptorIterable GetClusterIterable() const
RNTupleDescriptor CloneSchema() const
Creates a descriptor containing only the schema information about this RNTuple, i....
const std::string & GetDescription() const
std::uint64_t fGeneration
The generation of the descriptor.
ROOT::DescriptorId_t FindPrevClusterId(ROOT::DescriptorId_t clusterId) const
std::unique_ptr< RHeaderExtension > fHeaderExtension
const RFieldDescriptor & GetFieldZero() const
Generic information about the physical location of data.
const_iterator begin() const
const Int_t n
Definition legend1.C:16
RNTupleDescriptor CloneDescriptorSchema(const RNTupleDescriptor &desc)
std::vector< ROOT::Internal::RNTupleClusterBoundaries > GetClusterBoundaries(const RNTupleDescriptor &desc)
Return the cluster boundaries for each cluster in this RNTuple.
Namespace for new ROOT classes and functions.
EExtraTypeInfoIds
Used in RExtraTypeInfoDescriptor.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
ENTupleStructure
The fields in the RNTuple data model tree can carry different structural information about the type s...
Additional information about a page in an in-memory RPageRange.
RPageInfoExtended(const RPageInfo &pageInfo, ROOT::NTupleSize_t firstElementIndex, ROOT::NTupleSize_t pageNumber)
void SetFirstElementIndex(ROOT::NTupleSize_t firstInPage)
ROOT::NTupleSize_t fPageNumber
Page number in the corresponding RPageRange.
ROOT::NTupleSize_t fFirstElementIndex
Index (in cluster) of the first element in page.
void SetPageNumber(ROOT::NTupleSize_t pageNumber)
Information about a single page in the context of a cluster's page range.
bool fHasChecksum
If true, the 8 bytes following the serialized page are an xxhash of the on-disk page data.
void SetLocator(const RNTupleLocator &locator)
bool operator==(const RPageInfo &other) const
std::uint32_t fNElements
The sum of the elements of all the pages must match the corresponding fNElements field in fColumnRang...
const RNTupleLocator & GetLocator() const
RNTupleLocator fLocator
The meaning of fLocator depends on the storage backend.
RPageInfo(std::uint32_t nElements, const RNTupleLocator &locator, bool hasChecksum)
bool operator==(RValueRange other) const
RValueRange(std::pair< double, double > range)
bool operator!=(RValueRange other) const
bool fForwardCompatible
By default, creating a model will fail if any of the reconstructed fields contains an unknown column ...
bool fCreateBare
If true, the model will be created without a default entry (bare model).
bool fReconstructProjections
If set to true, projected fields will be reconstructed as such.
bool fEmulateUnknownTypes
If true, fields with a user defined type that have no available dictionaries will be reconstructed as...
static void output()