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 /// Tells if the field describes a user-defined enum type.
153 /// The dictionary does not need to be available for this method.
154 /// Needs the full descriptor to look up sub fields.
155 bool IsCustomEnum(const RNTupleDescriptor &desc) const;
156};
157
158// clang-format off
159/**
160\class ROOT::RColumnDescriptor
161\ingroup NTuple
162\brief Metadata stored for every column of an RNTuple
163*/
164// clang-format on
168
169public:
170 struct RValueRange {
171 double fMin = 0, fMax = 0;
172
173 RValueRange() = default;
174 RValueRange(double min, double max) : fMin(min), fMax(max) {}
175 RValueRange(std::pair<double, double> range) : fMin(range.first), fMax(range.second) {}
176
177 bool operator==(RValueRange other) const { return fMin == other.fMin && fMax == other.fMax; }
178 bool operator!=(RValueRange other) const { return !(*this == other); }
179 };
180
181private:
182 /// The actual column identifier, which is the link to the corresponding field
184 /// Usually identical to the logical column ID, except for alias columns where it references the shadowed column
186 /// Every column belongs to one and only one field
188 /// The absolute value specifies the index for the first stored element for this column.
189 /// For deferred columns the absolute value is larger than zero.
190 /// Negative values specify a suppressed and deferred column.
191 std::int64_t fFirstElementIndex = 0U;
192 /// A field can be serialized into several columns, which are numbered from zero to $n$
193 std::uint32_t fIndex = 0;
194 /// A field may use multiple column representations, which are numbered from zero to $m$.
195 /// Every representation has the same number of columns.
196 std::uint16_t fRepresentationIndex = 0;
197 /// The size in bits of elements of this column. Most columns have the size fixed by their type
198 /// but low-precision float columns have variable bit widths.
199 std::uint16_t fBitsOnStorage = 0;
200 /// The on-disk column type
202 /// Optional value range (used e.g. by quantized real fields)
203 std::optional<RValueRange> fValueRange;
204
205public:
206 RColumnDescriptor() = default;
211
212 bool operator==(const RColumnDescriptor &other) const;
213 /// Get a copy of the descriptor
214 RColumnDescriptor Clone() const;
215
219 std::uint32_t GetIndex() const { return fIndex; }
220 std::uint16_t GetRepresentationIndex() const { return fRepresentationIndex; }
221 std::uint64_t GetFirstElementIndex() const { return std::abs(fFirstElementIndex); }
222 std::uint16_t GetBitsOnStorage() const { return fBitsOnStorage; }
224 std::optional<RValueRange> GetValueRange() const { return fValueRange; }
226 bool IsDeferredColumn() const { return fFirstElementIndex != 0; }
228};
229
230// clang-format off
231/**
232\class ROOT::RClusterDescriptor
233\ingroup NTuple
234\brief Metadata for RNTuple clusters
235
236The cluster descriptor is built in two phases. In a first phase, the descriptor has only an ID.
237In a second phase, the event range, column group, page locations and column ranges are added.
238Both phases are populated by the RClusterDescriptorBuilder.
239Clusters span across all available columns in the RNTuple.
240*/
241// clang-format on
244
245public:
246 // clang-format off
247 /**
248 \class ROOT::RClusterDescriptor::RColumnRange
249 \ingroup NTuple
250 \brief The window of element indexes of a particular column in a particular cluster
251 */
252 // clang-format on
255 /// The global index of the first column element in the cluster
257 /// The number of column elements in the cluster
259 /// The usual format for ROOT compression settings (see Compression.h).
260 /// The pages of a particular column in a particular cluster are all compressed with the same settings.
261 /// If unset, the compression settings are undefined (deferred columns, suppressed columns).
262 std::optional<std::uint32_t> fCompressionSettings;
263 /// Suppressed columns have an empty page range and unknown compression settings.
264 /// Their element index range, however, is aligned with the corresponding column of the
265 /// primary column representation (see Section "Suppressed Columns" in the specification)
266 bool fIsSuppressed = false;
267
268 // TODO(jblomer): we perhaps want to store summary information, such as average, min/max, etc.
269 // Should this be done on the field level?
270
271 public:
272 RColumnRange() = default;
273
284
287
291
295
296 std::optional<std::uint32_t> GetCompressionSettings() const { return fCompressionSettings; }
297 void SetCompressionSettings(std::optional<std::uint32_t> comp) { fCompressionSettings = comp; }
298
299 bool IsSuppressed() const { return fIsSuppressed; }
301
302 bool operator==(const RColumnRange &other) const
303 {
304 return fPhysicalColumnId == other.fPhysicalColumnId && fFirstElementIndex == other.fFirstElementIndex &&
305 fNElements == other.fNElements && fCompressionSettings == other.fCompressionSettings &&
306 fIsSuppressed == other.fIsSuppressed;
307 }
308
313 };
314
315 // clang-format off
316 /**
317 \class ROOT::RClusterDescriptor::RPageInfo
318 \ingroup NTuple
319 \brief Information about a single page in the context of a cluster's page range.
320 */
321 // clang-format on
322 // NOTE: We do not need to store the element size / uncompressed page size because we know to which column
323 // the page belongs
324 struct RPageInfo {
325 private:
326 /// The sum of the elements of all the pages must match the corresponding `fNElements` field in `fColumnRanges`
327 std::uint32_t fNElements = std::uint32_t(-1);
328 /// The meaning of `fLocator` depends on the storage backend.
330 /// If true, the 8 bytes following the serialized page are an xxhash of the on-disk page data
331 bool fHasChecksum = false;
332
333 public:
334 RPageInfo() = default;
339
340 bool operator==(const RPageInfo &other) const
341 {
342 return fNElements == other.fNElements && fLocator == other.fLocator;
343 }
344
345 std::uint32_t GetNElements() const { return fNElements; }
346 void SetNElements(std::uint32_t n) { fNElements = n; }
347
348 const RNTupleLocator &GetLocator() const { return fLocator; }
351
352 bool HasChecksum() const { return fHasChecksum; }
354 };
355
356 // clang-format off
357 /**
358 \class ROOT::RClusterDescriptor::RPageInfoExtended
359 \ingroup NTuple
360 \brief Additional information about a page in an in-memory RPageRange.
361
362 Used by RPageRange::Find() to return information relative to the RPageRange. This information is not stored on disk
363 and we don't need to keep it in memory because it can be easily recomputed.
364 */
365 // clang-format on
386
387 // clang-format off
388 /**
389 \class ROOT::RClusterDescriptor::RPageRange
390 \ingroup NTuple
391 \brief Records the partition of data into pages for a particular column in a particular cluster
392 */
393 // clang-format on
396
397 private:
398 /// \brief Extend this RPageRange to fit the given RColumnRange.
399 ///
400 /// To do so, prepend as many synthetic RPageInfos as needed to cover the range in `columnRange`.
401 /// RPageInfos are constructed to contain as many elements of type `element` given a page size
402 /// limit of `pageSize` (in bytes); the locator for the referenced pages is `kTypePageZero`.
403 /// This function is used to make up RPageRanges for clusters that contain deferred columns.
404 /// \return The number of column elements covered by the synthesized RPageInfos
407
408 /// Has the same length than fPageInfos and stores the sum of the number of elements of all the pages
409 /// up to and including a given index. Used for binary search in Find().
410 std::vector<ROOT::NTupleSize_t> fCumulativeNElements;
411
413 std::vector<RPageInfo> fPageInfos;
414
415 public:
416 RPageRange() = default;
417 RPageRange(const RPageRange &other) = delete;
421
423 {
424 RPageRange clone;
426 clone.fPageInfos = fPageInfos;
428 return clone;
429 }
430
431 /// Find the page in the RPageRange that contains the given element. The element must exist.
433
436
437 const std::vector<RPageInfo> &GetPageInfos() const { return fPageInfos; }
438 std::vector<RPageInfo> &GetPageInfos() { return fPageInfos; }
439
440 bool operator==(const RPageRange &other) const
441 {
442 return fPhysicalColumnId == other.fPhysicalColumnId && fPageInfos == other.fPageInfos;
443 }
444 };
445
446private:
448 /// Clusters can be swapped by adjusting the entry offsets of the cluster and all ranges
451
452 std::unordered_map<ROOT::DescriptorId_t, RColumnRange> fColumnRanges;
453 std::unordered_map<ROOT::DescriptorId_t, RPageRange> fPageRanges;
454
455public:
457
463
465
466 bool operator==(const RClusterDescriptor &other) const;
467
473 /// Returns an iterator over pairs { columnId, columnRange }. The iteration order is unspecified.
474 RColumnRangeIterable GetColumnRangeIterable() const;
476 {
477 return fColumnRanges.find(physicalId) != fColumnRanges.end();
478 }
479 std::uint64_t GetNBytesOnStorage() const;
480};
481
483private:
485
486public:
488 private:
489 using Iter_t = std::unordered_map<ROOT::DescriptorId_t, RColumnRange>::const_iterator;
490 /// The wrapped map iterator
492
493 public:
494 using iterator_category = std::forward_iterator_tag;
497 using difference_type = std::ptrdiff_t;
498 using pointer = const RColumnRange *;
499 using reference = const RColumnRange &;
500
501 RIterator(Iter_t iter) : fIter(iter) {}
502 iterator &operator++() /* prefix */
503 {
504 ++fIter;
505 return *this;
506 }
507 iterator operator++(int) /* postfix */
508 {
509 auto old = *this;
510 operator++();
511 return old;
512 }
513 reference operator*() const { return fIter->second; }
514 pointer operator->() const { return &fIter->second; }
515 bool operator!=(const iterator &rh) const { return fIter != rh.fIter; }
516 bool operator==(const iterator &rh) const { return fIter == rh.fIter; }
517 };
518
519 explicit RColumnRangeIterable(const RClusterDescriptor &desc) : fDesc(desc) {}
520
521 RIterator begin() { return RIterator{fDesc.fColumnRanges.cbegin()}; }
522 RIterator end() { return RIterator{fDesc.fColumnRanges.cend()}; }
523 size_t size() { return fDesc.fColumnRanges.size(); }
524};
525
526// clang-format off
527/**
528\class ROOT::RClusterGroupDescriptor
529\ingroup NTuple
530\brief Clusters are bundled in cluster groups.
531
532Very large RNTuples can contain multiple cluster groups to organize cluster metadata.
533Every RNTuple has at least one cluster group. The clusters in a cluster group are ordered
534corresponding to their first entry number.
535*/
536// clang-format on
539
540private:
542 /// The cluster IDs can be empty if the corresponding page list is not loaded.
543 /// Otherwise, cluster ids are sorted by first entry number.
544 std::vector<ROOT::DescriptorId_t> fClusterIds;
545 /// The page list that corresponds to the cluster group
547 /// Uncompressed size of the page list
548 std::uint64_t fPageListLength = 0;
549 /// The minimum first entry number of the clusters in the cluster group
550 std::uint64_t fMinEntry = 0;
551 /// Number of entries that are (partially for sharded clusters) covered by this cluster group.
552 std::uint64_t fEntrySpan = 0;
553 /// Number of clusters is always known even if the cluster IDs are not (yet) populated
554 std::uint32_t fNClusters = 0;
555
556public:
562
564 /// Creates a clone without the cluster IDs
566
567 bool operator==(const RClusterGroupDescriptor &other) const;
568
570 std::uint32_t GetNClusters() const { return fNClusters; }
572 std::uint64_t GetPageListLength() const { return fPageListLength; }
573 const std::vector<ROOT::DescriptorId_t> &GetClusterIds() const { return fClusterIds; }
574 std::uint64_t GetMinEntry() const { return fMinEntry; }
575 std::uint64_t GetEntrySpan() const { return fEntrySpan; }
576 /// A cluster group is loaded in two stages. Stage one loads only the summary information.
577 /// Stage two loads the list of cluster IDs.
578 bool HasClusterDetails() const { return !fClusterIds.empty(); }
579};
580
581/// Used in RExtraTypeInfoDescriptor
583 kInvalid,
585};
586
587// clang-format off
588/**
589\class ROOT::RExtraTypeInfoDescriptor
590\ingroup NTuple
591\brief Field specific extra type information from the header / extenstion header
592
593Currently only used by streamer fields to store RNTuple-wide list of streamer info records.
594*/
595// clang-format on
598
599private:
600 /// Specifies the meaning of the extra information
602 /// Type version the extra type information is bound to
603 std::uint32_t fTypeVersion = 0;
604 /// The type name the extra information refers to; empty for RNTuple-wide extra information
605 std::string fTypeName;
606 /// The content format depends on the content ID and may be binary
607 std::string fContent;
608
609public:
615
616 bool operator==(const RExtraTypeInfoDescriptor &other) const;
617
619
621 std::uint32_t GetTypeVersion() const { return fTypeVersion; }
622 const std::string &GetTypeName() const { return fTypeName; }
623 const std::string &GetContent() const { return fContent; }
624};
625
626// clang-format off
627/**
628\class ROOT::RNTupleDescriptor
629\ingroup NTuple
630\brief The on-storage metadata of an RNTuple
631
632Represents the on-disk (on storage) information about an RNTuple. The metadata consists of a header, a footer, and
633potentially multiple page lists.
634The header carries the RNTuple schema, i.e. the fields and the associated columns and their relationships.
635The footer carries information about one or several cluster groups and links to their page lists.
636For every cluster group, a page list envelope stores cluster summaries and page locations.
637For every cluster, it stores for every column the range of element indexes as well as a list of pages and page
638locations.
639
640The descriptor provides machine-independent (de-)serialization of headers and footers, and it provides lookup routines
641for RNTuple objects (pages, clusters, ...). It is supposed to be usable by all RPageStorage implementations.
642
643The serialization does not use standard ROOT streamers in order to not let it depend on libCore. The serialization uses
644the concept of envelopes and frames: header, footer, and page list envelopes have a preamble with a type ID and length.
645Substructures are serialized in frames and have a size and number of items (for list frames). This allows for forward
646and backward compatibility when the metadata evolves.
647*/
648// clang-format on
652
653public:
654 class RHeaderExtension;
655
656private:
657 /// The RNTuple name needs to be unique in a given storage location (file)
658 std::string fName;
659 /// Free text from the user
660 std::string fDescription;
661
663
664 std::uint64_t fNPhysicalColumns = 0; ///< Updated by the descriptor builder when columns are added
665
666 std::set<unsigned int> fFeatureFlags;
667 std::unordered_map<ROOT::DescriptorId_t, RFieldDescriptor> fFieldDescriptors;
668 std::unordered_map<ROOT::DescriptorId_t, RColumnDescriptor> fColumnDescriptors;
669
670 std::vector<RExtraTypeInfoDescriptor> fExtraTypeInfoDescriptors;
671 std::unique_ptr<RHeaderExtension> fHeaderExtension;
672
673 //// All fields above are part of the schema and are cloned when creating a new descriptor from a given one
674 //// (see CloneSchema())
675
676 std::uint16_t fVersionEpoch = 0; ///< Set by the descriptor builder when deserialized
677 std::uint16_t fVersionMajor = 0; ///< Set by the descriptor builder when deserialized
678 std::uint16_t fVersionMinor = 0; ///< Set by the descriptor builder when deserialized
679 std::uint16_t fVersionPatch = 0; ///< Set by the descriptor builder when deserialized
680
681 std::uint64_t fOnDiskHeaderSize = 0; ///< Set by the descriptor builder when deserialized
682 std::uint64_t fOnDiskHeaderXxHash3 = 0; ///< Set by the descriptor builder when deserialized
683 std::uint64_t fOnDiskFooterSize = 0; ///< Like fOnDiskHeaderSize, contains both cluster summaries and page locations
684
685 std::uint64_t fNEntries = 0; ///< Updated by the descriptor builder when the cluster groups are added
686 std::uint64_t fNClusters = 0; ///< Updated by the descriptor builder when the cluster groups are added
687
688 /// \brief The generation of the descriptor
689 ///
690 /// Once constructed by an RNTupleDescriptorBuilder, the descriptor is mostly immutable except for the set of
691 /// active page locations. During the lifetime of the descriptor, page location information for clusters
692 /// can be added or removed. When this happens, the generation should be increased, so that users of the
693 /// descriptor know that the information changed. The generation is increased, e.g., by the page source's
694 /// exclusive lock guard around the descriptor. It is used, e.g., by the descriptor cache in RNTupleReader.
695 std::uint64_t fGeneration = 0;
696
697 std::unordered_map<ROOT::DescriptorId_t, RClusterGroupDescriptor> fClusterGroupDescriptors;
698 /// References cluster groups sorted by entry range and thus allows for binary search.
699 /// Note that this list is empty during the descriptor building process and will only be
700 /// created when the final descriptor is extracted from the builder.
701 std::vector<ROOT::DescriptorId_t> fSortedClusterGroupIds;
702 /// Potentially a subset of all the available clusters
703 std::unordered_map<ROOT::DescriptorId_t, RClusterDescriptor> fClusterDescriptors;
704
705 // We don't expose this publicly because when we add sharded clusters, this interface does not make sense anymore
707
708 /// Creates a descriptor containing only the schema information about this RNTuple, i.e. all the information needed
709 /// to create a new RNTuple with the same schema as this one but not necessarily the same clustering. This is used
710 /// when merging two RNTuples.
712
713public:
714 static constexpr unsigned int kFeatureFlagTest = 137; // Bit reserved for forward-compatibility testing
715
721
722 /// Modifiers passed to CreateModel()
724 private:
725 /// If set to true, projected fields will be reconstructed as such. This will prevent the model to be used
726 /// with an RNTupleReader, but it is useful, e.g., to accurately merge data.
728 /// By default, creating a model will fail if any of the reconstructed fields contains an unknown column type
729 /// or an unknown field structural role.
730 /// If this option is enabled, the model will be created and all fields containing unknown data (directly
731 /// or indirectly) will be skipped instead.
732 bool fForwardCompatible = false;
733 /// If true, the model will be created without a default entry (bare model).
734 bool fCreateBare = false;
735 /// If true, fields with a user defined type that have no available dictionaries will be reconstructed
736 /// as record fields from the on-disk information; otherwise, they will cause an error.
738
739 public:
740 RCreateModelOptions() {} // Work around compiler bug, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88165
741
744
747
748 void SetCreateBare(bool v) { fCreateBare = v; }
749 bool GetCreateBare() const { return fCreateBare; }
750
753 };
754
755 RNTupleDescriptor() = default;
760
761 RNTupleDescriptor Clone() const;
762
763 bool operator==(const RNTupleDescriptor &other) const;
764
765 std::uint64_t GetOnDiskHeaderXxHash3() const { return fOnDiskHeaderXxHash3; }
766 std::uint64_t GetOnDiskHeaderSize() const { return fOnDiskHeaderSize; }
767 std::uint64_t GetOnDiskFooterSize() const { return fOnDiskFooterSize; }
768
785
786 RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const;
787 RFieldDescriptorIterable
789 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
790 RFieldDescriptorIterable GetFieldIterable(ROOT::DescriptorId_t fieldId) const;
791 RFieldDescriptorIterable
793 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
794
795 RFieldDescriptorIterable GetTopLevelFields() const;
796 RFieldDescriptorIterable
797 GetTopLevelFields(const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
798
799 RColumnDescriptorIterable GetColumnIterable() const;
800 RColumnDescriptorIterable GetColumnIterable(const RFieldDescriptor &fieldDesc) const;
801 RColumnDescriptorIterable GetColumnIterable(ROOT::DescriptorId_t fieldId) const;
802
803 RClusterGroupDescriptorIterable GetClusterGroupIterable() const;
804
805 RClusterDescriptorIterable GetClusterIterable() const;
806
807 RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const;
808
809 const std::string &GetName() const { return fName; }
810 const std::string &GetDescription() const { return fDescription; }
811
812 std::size_t GetNFields() const { return fFieldDescriptors.size(); }
813 std::size_t GetNLogicalColumns() const { return fColumnDescriptors.size(); }
814 std::size_t GetNPhysicalColumns() const { return fNPhysicalColumns; }
815 std::size_t GetNClusterGroups() const { return fClusterGroupDescriptors.size(); }
816 std::size_t GetNClusters() const { return fNClusters; }
817 std::size_t GetNActiveClusters() const { return fClusterDescriptors.size(); }
818 std::size_t GetNExtraTypeInfos() const { return fExtraTypeInfoDescriptors.size(); }
819
820 /// We know the number of entries from adding the cluster summaries
823
824 /// Returns the logical parent of all top-level RNTuple data fields.
828 /// Searches for a top-level field
829 ROOT::DescriptorId_t FindFieldId(std::string_view fieldName) const;
831 std::uint16_t representationIndex) const;
833 std::uint16_t representationIndex) const;
837
838 /// Walks up the parents of the field ID and returns a field name of the form a.b.c.d
839 /// In case of invalid field ID, an empty string is returned.
841
842 /// Adjust the type name of the passed RFieldDescriptor for comparison with another renormalized type name.
843 std::string GetTypeNameForComparison(const RFieldDescriptor &fieldDesc) const;
844
845 bool HasFeature(unsigned int flag) const { return fFeatureFlags.count(flag) > 0; }
846 std::vector<std::uint64_t> GetFeatureFlags() const;
847
848 /// Return header extension information; if the descriptor does not have a header extension, return `nullptr`
849 const RHeaderExtension *GetHeaderExtension() const { return fHeaderExtension.get(); }
850
851 /// Methods to load and drop cluster group details (cluster IDs and page locations)
855
856 std::uint64_t GetGeneration() const { return fGeneration; }
858
859 /// Re-create the C++ model from the stored metadata
860 std::unique_ptr<ROOT::RNTupleModel> CreateModel(const RCreateModelOptions &options = RCreateModelOptions()) const;
861 void PrintInfo(std::ostream &output) const;
862};
863
864// clang-format off
865/**
866\class ROOT::RNTupleDescriptor::RColumnDescriptorIterable
867\ingroup NTuple
868\brief Used to loop over a field's associated columns
869*/
870// clang-format on
872private:
873 /// The associated RNTuple for this range.
875 /// The descriptor ids of the columns ordered by field, representation, and column index
876 std::vector<ROOT::DescriptorId_t> fColumns = {};
877
878public:
880 private:
881 /// The enclosing range's RNTuple.
883 /// The enclosing range's descriptor id list.
884 const std::vector<ROOT::DescriptorId_t> &fColumns;
885 std::size_t fIndex = 0;
886
887 public:
888 using iterator_category = std::forward_iterator_tag;
891 using difference_type = std::ptrdiff_t;
892 using pointer = const RColumnDescriptor *;
894
895 RIterator(const RNTupleDescriptor &ntuple, const std::vector<ROOT::DescriptorId_t> &columns, std::size_t index)
897 {
898 }
899 iterator &operator++() /* prefix */
900 {
901 ++fIndex;
902 return *this;
903 }
904 iterator operator++(int) /* postfix */
905 {
906 auto old = *this;
907 operator++();
908 return old;
909 }
910 reference operator*() const { return fNTuple.GetColumnDescriptor(fColumns.at(fIndex)); }
911 pointer operator->() const { return &fNTuple.GetColumnDescriptor(fColumns.at(fIndex)); }
912 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
913 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
914 };
915
918
921 size_t size() { return fColumns.size(); }
922};
923
924// clang-format off
925/**
926\class ROOT::RNTupleDescriptor::RFieldDescriptorIterable
927\ingroup NTuple
928\brief Used to loop over a field's child fields
929*/
930// clang-format on
932private:
933 /// The associated RNTuple for this range.
935 /// The descriptor IDs of the child fields. These may be sorted using
936 /// a comparison function.
937 std::vector<ROOT::DescriptorId_t> fFieldChildren = {};
938
939public:
941 private:
942 /// The enclosing range's RNTuple.
944 /// The enclosing range's descriptor id list.
945 const std::vector<ROOT::DescriptorId_t> &fFieldChildren;
946 std::size_t fIndex = 0;
947
948 public:
949 using iterator_category = std::forward_iterator_tag;
952 using difference_type = std::ptrdiff_t;
953 using pointer = const RFieldDescriptor *;
955
956 RIterator(const RNTupleDescriptor &ntuple, const std::vector<ROOT::DescriptorId_t> &fieldChildren,
957 std::size_t index)
959 {
960 }
961 iterator &operator++() /* prefix */
962 {
963 ++fIndex;
964 return *this;
965 }
966 iterator operator++(int) /* postfix */
967 {
968 auto old = *this;
969 operator++();
970 return old;
971 }
972 reference operator*() const { return fNTuple.GetFieldDescriptor(fFieldChildren.at(fIndex)); }
973 pointer operator->() const { return &fNTuple.GetFieldDescriptor(fFieldChildren.at(fIndex)); }
974 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
975 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
976 };
981 /// Sort the range using an arbitrary comparison function.
983 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator)
984 : fNTuple(ntuple), fFieldChildren(field.GetLinkIds())
985 {
986 std::sort(fFieldChildren.begin(), fFieldChildren.end(), comparator);
987 }
990};
991
992// clang-format off
993/**
994\class ROOT::RNTupleDescriptor::RClusterGroupDescriptorIterable
995\ingroup NTuple
996\brief Used to loop over all the cluster groups of an RNTuple (in unspecified order)
997
998Enumerate all cluster group IDs from the descriptor. No specific order can be assumed.
999*/
1000// clang-format on
1002private:
1003 /// The associated RNTuple for this range.
1005
1006public:
1008 private:
1009 using Iter_t = std::unordered_map<ROOT::DescriptorId_t, RClusterGroupDescriptor>::const_iterator;
1010 /// The wrapped map iterator
1012
1013 public:
1014 using iterator_category = std::forward_iterator_tag;
1017 using difference_type = std::ptrdiff_t;
1020
1021 RIterator(Iter_t iter) : fIter(iter) {}
1022 iterator &operator++() /* prefix */
1023 {
1024 ++fIter;
1025 return *this;
1026 }
1027 iterator operator++(int) /* postfix */
1028 {
1029 auto old = *this;
1030 operator++();
1031 return old;
1032 }
1033 reference operator*() const { return fIter->second; }
1034 pointer operator->() const { return &fIter->second; }
1035 bool operator!=(const iterator &rh) const { return fIter != rh.fIter; }
1036 bool operator==(const iterator &rh) const { return fIter == rh.fIter; }
1037 };
1038
1040 RIterator begin() { return RIterator(fNTuple.fClusterGroupDescriptors.cbegin()); }
1041 RIterator end() { return RIterator(fNTuple.fClusterGroupDescriptors.cend()); }
1042};
1043
1044// clang-format off
1045/**
1046\class ROOT::RNTupleDescriptor::RClusterDescriptorIterable
1047\ingroup NTuple
1048\brief Used to loop over all the clusters of an RNTuple (in unspecified order)
1049
1050Enumerate all cluster IDs from all cluster descriptors. No specific order can be assumed, use
1051RNTupleDescriptor::FindNextClusterId() and RNTupleDescriptor::FindPrevClusterId() to traverse
1052clusters by entry number.
1053*/
1054// clang-format on
1056private:
1057 /// The associated RNTuple for this range.
1059
1060public:
1062 private:
1063 using Iter_t = std::unordered_map<ROOT::DescriptorId_t, RClusterDescriptor>::const_iterator;
1064 /// The wrapped map iterator
1066
1067 public:
1068 using iterator_category = std::forward_iterator_tag;
1071 using difference_type = std::ptrdiff_t;
1074
1075 RIterator(Iter_t iter) : fIter(iter) {}
1076 iterator &operator++() /* prefix */
1077 {
1078 ++fIter;
1079 return *this;
1080 }
1081 iterator operator++(int) /* postfix */
1082 {
1083 auto old = *this;
1084 operator++();
1085 return old;
1086 }
1087 reference operator*() const { return fIter->second; }
1088 pointer operator->() const { return &fIter->second; }
1089 bool operator!=(const iterator &rh) const { return fIter != rh.fIter; }
1090 bool operator==(const iterator &rh) const { return fIter == rh.fIter; }
1091 };
1092
1094 RIterator begin() { return RIterator(fNTuple.fClusterDescriptors.cbegin()); }
1095 RIterator end() { return RIterator(fNTuple.fClusterDescriptors.cend()); }
1096};
1097
1098// clang-format off
1099/**
1100\class ROOT::RNTupleDescriptor::RExtraTypeInfoDescriptorIterable
1101\ingroup NTuple
1102\brief Used to loop over all the extra type info record of an RNTuple (in unspecified order)
1103*/
1104// clang-format on
1106private:
1107 /// The associated RNTuple for this range.
1109
1110public:
1112 private:
1113 using Iter_t = std::vector<RExtraTypeInfoDescriptor>::const_iterator;
1114 /// The wrapped vector iterator
1116
1117 public:
1118 using iterator_category = std::forward_iterator_tag;
1121 using difference_type = std::ptrdiff_t;
1124
1125 RIterator(Iter_t iter) : fIter(iter) {}
1126 iterator &operator++() /* prefix */
1127 {
1128 ++fIter;
1129 return *this;
1130 }
1131 iterator operator++(int) /* postfix */
1132 {
1133 auto old = *this;
1134 operator++();
1135 return old;
1136 }
1137 reference operator*() const { return *fIter; }
1138 pointer operator->() const { return &*fIter; }
1139 bool operator!=(const iterator &rh) const { return fIter != rh.fIter; }
1140 bool operator==(const iterator &rh) const { return fIter == rh.fIter; }
1141 };
1142
1144 RIterator begin() { return RIterator(fNTuple.fExtraTypeInfoDescriptors.cbegin()); }
1145 RIterator end() { return RIterator(fNTuple.fExtraTypeInfoDescriptors.cend()); }
1146};
1147
1148// clang-format off
1149/**
1150\class ROOT::RNTupleDescriptor::RHeaderExtension
1151\ingroup NTuple
1152\brief Summarizes information about fields and the corresponding columns that were added after the header has been serialized
1153*/
1154// clang-format on
1157
1158private:
1159 /// All field IDs of late model extensions, in the order of field addition. This is necessary to serialize the
1160 /// the fields in that order.
1161 std::vector<ROOT::DescriptorId_t> fFieldIdsOrder;
1162 /// All field IDs of late model extensions for efficient lookup. When a column gets added to the extension
1163 /// header, this enables us to determine if the column belongs to a field of the header extension of if it
1164 /// belongs to a field of the regular header that gets extended by additional column representations.
1165 std::unordered_set<ROOT::DescriptorId_t> fFieldIdsLookup;
1166 /// All logical column IDs of columns that extend, with additional column representations, fields of the regular
1167 /// header. During serialization, these columns are not picked up as columns of `fFieldIdsOrder`. But instead
1168 /// these columns need to be serialized in the extension header without re-serializing the field.
1169 std::vector<ROOT::DescriptorId_t> fExtendedColumnRepresentations;
1170 /// Number of logical and physical columns; updated by the descriptor builder when columns are added
1171 std::uint32_t fNLogicalColumns = 0;
1172 std::uint32_t fNPhysicalColumns = 0;
1173
1174 /// Marks `fieldDesc` as an extended field, i.e. a field that appears in the Header Extension (e.g. having been added
1175 /// through late model extension). Note that the field descriptor should also have been added to the RNTuple
1176 /// Descriptor alongside non-extended fields.
1178 {
1179 fFieldIdsOrder.emplace_back(fieldDesc.GetId());
1180 fFieldIdsLookup.insert(fieldDesc.GetId());
1181 }
1182
1183 /// Marks `columnDesc` as an extended column, i.e. a column that appears in the Header Extension (e.g. having been
1184 /// added through late model extension as an additional representation of an existing column). Note that the column
1185 /// descriptor should also have been added to the RNTuple Descriptor alongside non-extended columns.
1187 {
1189 if (!columnDesc.IsAliasColumn())
1191 if (fFieldIdsLookup.count(columnDesc.GetFieldId()) == 0) {
1192 fExtendedColumnRepresentations.emplace_back(columnDesc.GetLogicalId());
1193 }
1194 }
1195
1196public:
1197 std::size_t GetNFields() const { return fFieldIdsOrder.size(); }
1198 std::size_t GetNLogicalColumns() const { return fNLogicalColumns; }
1199 std::size_t GetNPhysicalColumns() const { return fNPhysicalColumns; }
1200 const std::vector<ROOT::DescriptorId_t> &GetExtendedColumnRepresentations() const
1201 {
1203 }
1204 /// Return a vector containing the IDs of the top-level fields defined in the extension header, in the order
1205 /// of their addition.
1206 /// We cannot create this vector when building the fFields because at the time when AddExtendedField is called,
1207 /// the field is not yet linked into the schema tree.
1208 std::vector<ROOT::DescriptorId_t> GetTopLevelFields(const RNTupleDescriptor &desc) const;
1209
1211 {
1212 return fFieldIdsLookup.find(fieldId) != fFieldIdsLookup.end();
1213 }
1219};
1220
1221namespace Internal {
1222
1223// clang-format off
1224/**
1225\class ROOT::Internal::RColumnDescriptorBuilder
1226\ingroup NTuple
1227\brief A helper class for piece-wise construction of an RColumnDescriptor
1228
1229Dangling column descriptors can become actual descriptors when added to an
1230RNTupleDescriptorBuilder instance and then linked to their fields.
1231*/
1232// clang-format on
1234private:
1236
1237public:
1238 /// Make an empty column descriptor builder.
1240
1252 {
1254 return *this;
1255 }
1257 {
1258 fColumn.fType = type;
1259 return *this;
1260 }
1267 {
1269 return *this;
1270 }
1288 RColumnDescriptorBuilder &ValueRange(double min, double max)
1289 {
1290 fColumn.fValueRange = {min, max};
1291 return *this;
1292 }
1293 RColumnDescriptorBuilder &ValueRange(std::optional<RColumnDescriptor::RValueRange> valueRange)
1294 {
1296 return *this;
1297 }
1300 /// Attempt to make a column descriptor. This may fail if the column
1301 /// was not given enough information to make a proper descriptor.
1303};
1304
1305// clang-format off
1306/**
1307\class ROOT::Internal::RFieldDescriptorBuilder
1308\ingroup NTuple
1309\brief A helper class for piece-wise construction of an RFieldDescriptor
1310
1311Dangling field descriptors describe a single field in isolation. They are
1312missing the necessary relationship information (parent field, any child fields)
1313required to describe a real RNTuple field.
1314
1315Dangling field descriptors can only become actual descriptors when added to an
1316RNTupleDescriptorBuilder instance and then linked to other fields.
1317*/
1318// clang-format on
1320private:
1322
1323public:
1324 /// Make an empty dangling field descriptor.
1326
1327 /// Make a new RFieldDescriptorBuilder based off a live RNTuple field.
1329
1336 {
1338 return *this;
1339 }
1341 {
1343 return *this;
1344 }
1346 {
1348 return *this;
1349 }
1356 {
1358 return *this;
1359 }
1361 {
1363 return *this;
1364 }
1365 RFieldDescriptorBuilder &TypeName(const std::string &typeName)
1366 {
1367 fField.fTypeName = typeName;
1368 return *this;
1369 }
1371 {
1373 return *this;
1374 }
1376 {
1378 return *this;
1379 }
1381 {
1382 fField.fStructure = structure;
1383 return *this;
1384 }
1385 RFieldDescriptorBuilder &TypeChecksum(const std::optional<std::uint32_t> typeChecksum)
1386 {
1388 return *this;
1389 }
1391 /// Attempt to make a field descriptor. This may fail if the dangling field
1392 /// was not given enough information to make a proper descriptor.
1394};
1395
1396// clang-format off
1397/**
1398\class ROOT::Internal::RClusterDescriptorBuilder
1399\ingroup NTuple
1400\brief A helper class for piece-wise construction of an RClusterDescriptor
1401
1402The cluster descriptor builder starts from a summary-only cluster descriptor and allows for the
1403piecewise addition of page locations.
1404*/
1405// clang-format on
1407private:
1409
1410public:
1416
1422
1424 {
1426 return *this;
1427 }
1428
1431
1432 /// Books the given column ID as being suppressed in this cluster. The correct first element index and number of
1433 /// elements need to be set by CommitSuppressedColumnRanges() once all the calls to CommitColumnRange() and
1434 /// MarkSuppressedColumnRange() took place.
1436
1437 /// Sets the first element index and number of elements for all the suppressed column ranges.
1438 /// The information is taken from the corresponding columns from the primary representation.
1439 /// Needs to be called when all the columns (suppressed and regular) where added.
1441
1442 /// Add column and page ranges for columns created during late model extension missing in this cluster. The locator
1443 /// type for the synthesized page ranges is `kTypePageZero`. All the page sources must be able to populate the
1444 /// 'zero' page from such locator. Any call to CommitColumnRange() and CommitSuppressedColumnRanges()
1445 /// should happen before calling this function.
1447
1452
1453 /// Move out the full cluster descriptor including page locations
1455};
1456
1457// clang-format off
1458/**
1459\class ROOT::Internal::RClusterGroupDescriptorBuilder
1460\ingroup NTuple
1461\brief A helper class for piece-wise construction of an RClusterGroupDescriptor
1462*/
1463// clang-format on
1465private:
1467
1468public:
1471
1488 {
1490 return *this;
1491 }
1493 {
1495 return *this;
1496 }
1498 {
1500 return *this;
1501 }
1502 void AddSortedClusters(const std::vector<ROOT::DescriptorId_t> &clusterIds)
1503 {
1504 if (clusterIds.size() != fClusterGroup.GetNClusters())
1505 throw RException(R__FAIL("mismatch of number of clusters"));
1507 }
1508
1510};
1511
1512// clang-format off
1513/**
1514\class ROOT::Internal::RExtraTypeInfoDescriptorBuilder
1515\ingroup NTuple
1516\brief A helper class for piece-wise construction of an RExtraTypeInfoDescriptor
1517*/
1518// clang-format on
1520private:
1522
1523public:
1525
1532 {
1534 return *this;
1535 }
1536 RExtraTypeInfoDescriptorBuilder &TypeName(const std::string &typeName)
1537 {
1538 fExtraTypeInfo.fTypeName = typeName;
1539 return *this;
1540 }
1542 {
1544 return *this;
1545 }
1546
1548};
1549
1550// clang-format off
1551/**
1552\class ROOT::Internal::RNTupleDescriptorBuilder
1553\ingroup NTuple
1554\brief A helper class for piece-wise construction of an RNTupleDescriptor
1555
1556Used by RPageStorage implementations in order to construct the RNTupleDescriptor from the various header parts.
1557*/
1558// clang-format on
1560private:
1563
1564public:
1565 /// Checks whether invariants hold:
1566 /// * RNTuple epoch is valid
1567 /// * RNTuple name is valid
1568 /// * Fields have valid parents
1569 /// * Number of columns is constant across column representations
1573
1574 /// Copies the "schema" part of `descriptor` into the builder's descriptor.
1575 /// This resets the builder's descriptor.
1577
1578 void SetVersion(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor,
1579 std::uint16_t versionPatch);
1580 void SetVersionForWriting();
1581
1582 void SetNTuple(const std::string_view name, const std::string_view description);
1583 void SetFeature(unsigned int flag);
1584
1587 /// The real footer size also include the page list envelopes
1589
1590 void AddField(const RFieldDescriptor &fieldDesc);
1593
1594 // The field that the column belongs to has to be already available. For fields with multiple columns,
1595 // the columns need to be added in order of the column index
1597
1600
1603
1604 /// Mark the beginning of the header extension; any fields and columns added after a call to this function are
1605 /// annotated as begin part of the header extension.
1606 void BeginHeaderExtension();
1607
1608 /// \brief Shift column IDs of alias columns by `offset`
1609 ///
1610 /// If the descriptor is constructed in pieces consisting of physical and alias columns
1611 /// (regular and projected fields), the natural column order would be
1612 /// - Physical and alias columns of piece one
1613 /// - Physical and alias columns of piece two
1614 /// - etc.
1615 /// What we want, however, are first all physical column IDs and then all alias column IDs.
1616 /// This method adds `offset` to the logical column IDs of all alias columns and fixes up the corresponding
1617 /// column IDs in the projected field descriptors. In this way, a new piece of physical and alias columns can
1618 /// first shift the existing alias columns by the number of new physical columns, resulting in the following order
1619 /// - Physical columns of piece one
1620 /// - Physical columns of piece two
1621 /// - ...
1622 // - Logical columns of piece one
1623 /// - Logical columns of piece two
1624 /// - ...
1625 void ShiftAliasColumns(std::uint32_t offset);
1626
1627 /// Get the streamer info records for custom classes. Currently requires the corresponding dictionaries to be loaded.
1629};
1630
1632{
1633 return desc.CloneSchema();
1634}
1635
1636} // namespace Internal
1637} // namespace ROOT
1638
1639#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 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 IsCustomEnum(const RNTupleDescriptor &desc) const
Tells if the field describes a user-defined enum type.
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...
std::unordered_map< ROOT::DescriptorId_t, RClusterDescriptor >::const_iterator Iter_t
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)
std::unordered_map< ROOT::DescriptorId_t, RClusterGroupDescriptor >::const_iterator Iter_t
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)
std::vector< RExtraTypeInfoDescriptor >::const_iterator Iter_t
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 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.
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()