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/RNTupleUtil.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);
62} // namespace Internal
63
64// clang-format off
65/**
66\class ROOT::RFieldDescriptor
67\ingroup NTuple
68\brief Metadata stored for every field of an RNTuple
69*/
70// clang-format on
74
75private:
77 /// The version of the C++-type-to-column translation mechanics
78 std::uint32_t fFieldVersion = 0;
79 /// The version of the C++ type itself
80 std::uint32_t fTypeVersion = 0;
81 /// The leaf name, not including parent fields
82 std::string fFieldName;
83 /// Free text set by the user
84 std::string fFieldDescription;
85 /// The C++ type that was used when writing the field
86 std::string fTypeName;
87 /// A typedef or using directive that resolved to the type name during field creation
88 std::string fTypeAlias;
89 /// The number of elements per entry for fixed-size arrays
90 std::uint64_t fNRepetitions = 0;
91 /// The structural information carried by this field in the data model tree
93 /// Establishes sub field relationships, such as classes and collections
95 /// For projected fields, the source field ID
97 /// The pointers in the other direction from parent to children. They are serialized, too, to keep the
98 /// order of sub fields.
99 std::vector<ROOT::DescriptorId_t> fLinkIds;
100 /// The number of columns in the column representations of the field. The column cardinality helps to navigate the
101 /// list of logical column ids. For example, the second column of the third column representation is
102 /// fLogicalColumnIds[2 * fColumnCardinality + 1]
103 std::uint32_t fColumnCardinality = 0;
104 /// The ordered list of columns attached to this field: first by representation index then by column index.
105 std::vector<ROOT::DescriptorId_t> fLogicalColumnIds;
106 /// For custom classes, we store the ROOT TClass reported checksum to facilitate the use of I/O rules that
107 /// identify types by their checksum
108 std::optional<std::uint32_t> fTypeChecksum;
109
110public:
111 RFieldDescriptor() = default;
116
117 bool operator==(const RFieldDescriptor &other) const;
118 /// Get a copy of the descriptor
119 RFieldDescriptor Clone() const;
120
121 /// In general, we create a field simply from the C++ type name. For untyped fields, however, we potentially need
122 /// access to sub fields, which is provided by the RNTupleDescriptor argument.
123 std::unique_ptr<ROOT::RFieldBase>
124 CreateField(const RNTupleDescriptor &ntplDesc, const ROOT::RCreateFieldOptions &options = {}) const;
125
127 std::uint32_t GetFieldVersion() const { return fFieldVersion; }
128 std::uint32_t GetTypeVersion() const { return fTypeVersion; }
129 const std::string &GetFieldName() const { return fFieldName; }
130 const std::string &GetFieldDescription() const { return fFieldDescription; }
131 const std::string &GetTypeName() const { return fTypeName; }
132 const std::string &GetTypeAlias() const { return fTypeAlias; }
133 std::uint64_t GetNRepetitions() const { return fNRepetitions; }
137 const std::vector<ROOT::DescriptorId_t> &GetLinkIds() const { return fLinkIds; }
138 const std::vector<ROOT::DescriptorId_t> &GetLogicalColumnIds() const { return fLogicalColumnIds; }
139 std::uint32_t GetColumnCardinality() const { return fColumnCardinality; }
140 std::optional<std::uint32_t> GetTypeChecksum() const { return fTypeChecksum; }
142 /// Tells if the field describes a user-defined class rather than a fundamental type, a collection, or one of the
143 /// natively supported stdlib classes.
144 /// The dictionary does not need to be available for this method.
145 bool IsCustomClass() const;
146};
147
148// clang-format off
149/**
150\class ROOT::RColumnDescriptor
151\ingroup NTuple
152\brief Metadata stored for every column of an RNTuple
153*/
154// clang-format on
158
159public:
160 struct RValueRange {
161 double fMin = 0, fMax = 0;
162
163 RValueRange() = default;
164 RValueRange(double min, double max) : fMin(min), fMax(max) {}
165 RValueRange(std::pair<double, double> range) : fMin(range.first), fMax(range.second) {}
166
167 bool operator==(RValueRange other) const { return fMin == other.fMin && fMax == other.fMax; }
168 bool operator!=(RValueRange other) const { return !(*this == other); }
169 };
170
171private:
172 /// The actual column identifier, which is the link to the corresponding field
174 /// Usually identical to the logical column ID, except for alias columns where it references the shadowed column
176 /// Every column belongs to one and only one field
178 /// The absolute value specifies the index for the first stored element for this column.
179 /// For deferred columns the absolute value is larger than zero.
180 /// Negative values specify a suppressed and deferred column.
181 std::int64_t fFirstElementIndex = 0U;
182 /// A field can be serialized into several columns, which are numbered from zero to $n$
183 std::uint32_t fIndex = 0;
184 /// A field may use multiple column representations, which are numbered from zero to $m$.
185 /// Every representation has the same number of columns.
186 std::uint16_t fRepresentationIndex = 0;
187 /// The size in bits of elements of this column. Most columns have the size fixed by their type
188 /// but low-precision float columns have variable bit widths.
189 std::uint16_t fBitsOnStorage = 0;
190 /// The on-disk column type
192 /// Optional value range (used e.g. by quantized real fields)
193 std::optional<RValueRange> fValueRange;
194
195public:
196 RColumnDescriptor() = default;
201
202 bool operator==(const RColumnDescriptor &other) const;
203 /// Get a copy of the descriptor
204 RColumnDescriptor Clone() const;
205
209 std::uint32_t GetIndex() const { return fIndex; }
210 std::uint16_t GetRepresentationIndex() const { return fRepresentationIndex; }
211 std::uint64_t GetFirstElementIndex() const { return std::abs(fFirstElementIndex); }
212 std::uint16_t GetBitsOnStorage() const { return fBitsOnStorage; }
214 std::optional<RValueRange> GetValueRange() const { return fValueRange; }
216 bool IsDeferredColumn() const { return fFirstElementIndex != 0; }
218};
219
220// clang-format off
221/**
222\class ROOT::RClusterDescriptor
223\ingroup NTuple
224\brief Metadata for RNTuple clusters
225
226The cluster descriptor is built in two phases. In a first phase, the descriptor has only an ID.
227In a second phase, the event range, column group, page locations and column ranges are added.
228Both phases are populated by the RClusterDescriptorBuilder.
229Clusters span across all available columns in the RNTuple.
230*/
231// clang-format on
234
235public:
236 // clang-format off
237 /**
238 \class ROOT::RClusterDescriptor::RColumnRange
239 \ingroup NTuple
240 \brief The window of element indexes of a particular column in a particular cluster
241 */
242 // clang-format on
245 /// The global index of the first column element in the cluster
247 /// The number of column elements in the cluster
249 /// The usual format for ROOT compression settings (see Compression.h).
250 /// The pages of a particular column in a particular cluster are all compressed with the same settings.
251 /// If unset, the compression settings are undefined (deferred columns, suppressed columns).
252 std::optional<std::uint32_t> fCompressionSettings;
253 /// Suppressed columns have an empty page range and unknown compression settings.
254 /// Their element index range, however, is aligned with the corresponding column of the
255 /// primary column representation (see Section "Suppressed Columns" in the specification)
256 bool fIsSuppressed = false;
257
258 // TODO(jblomer): we perhaps want to store summary information, such as average, min/max, etc.
259 // Should this be done on the field level?
260
261 public:
262 RColumnRange() = default;
263
274
277
281
285
286 std::optional<std::uint32_t> GetCompressionSettings() const { return fCompressionSettings; }
287 void SetCompressionSettings(std::optional<std::uint32_t> comp) { fCompressionSettings = comp; }
288
289 bool IsSuppressed() const { return fIsSuppressed; }
291
292 bool operator==(const RColumnRange &other) const
293 {
294 return fPhysicalColumnId == other.fPhysicalColumnId && fFirstElementIndex == other.fFirstElementIndex &&
295 fNElements == other.fNElements && fCompressionSettings == other.fCompressionSettings &&
296 fIsSuppressed == other.fIsSuppressed;
297 }
298
303 };
304
305 // clang-format off
306 /**
307 \class ROOT::RClusterDescriptor::RPageInfo
308 \ingroup NTuple
309 \brief Information about a single page in the context of a cluster's page range.
310 */
311 // clang-format on
312 // NOTE: We do not need to store the element size / uncompressed page size because we know to which column
313 // the page belongs
314 struct RPageInfo {
315 private:
316 /// The sum of the elements of all the pages must match the corresponding `fNElements` field in `fColumnRanges`
317 std::uint32_t fNElements = std::uint32_t(-1);
318 /// The meaning of `fLocator` depends on the storage backend.
320 /// If true, the 8 bytes following the serialized page are an xxhash of the on-disk page data
321 bool fHasChecksum = false;
322
323 public:
324 RPageInfo() = default;
329
330 bool operator==(const RPageInfo &other) const
331 {
332 return fNElements == other.fNElements && fLocator == other.fLocator;
333 }
334
335 std::uint32_t GetNElements() const { return fNElements; }
336 void SetNElements(std::uint32_t n) { fNElements = n; }
337
338 const RNTupleLocator &GetLocator() const { return fLocator; }
341
342 bool HasChecksum() const { return fHasChecksum; }
344 };
345
346 // clang-format off
347 /**
348 \class ROOT::RClusterDescriptor::RPageInfoExtended
349 \ingroup NTuple
350 \brief Additional information about a page in an in-memory RPageRange.
351
352 Used by RPageRange::Find() to return information relative to the RPageRange. This information is not stored on disk
353 and we don't need to keep it in memory because it can be easily recomputed.
354 */
355 // clang-format on
376
377 // clang-format off
378 /**
379 \class ROOT::RClusterDescriptor::RPageRange
380 \ingroup NTuple
381 \brief Records the partition of data into pages for a particular column in a particular cluster
382 */
383 // clang-format on
386
387 private:
388 /// \brief Extend this RPageRange to fit the given RColumnRange.
389 ///
390 /// To do so, prepend as many synthetic RPageInfos as needed to cover the range in `columnRange`.
391 /// RPageInfos are constructed to contain as many elements of type `element` given a page size
392 /// limit of `pageSize` (in bytes); the locator for the referenced pages is `kTypePageZero`.
393 /// This function is used to make up RPageRanges for clusters that contain deferred columns.
394 /// \return The number of column elements covered by the synthesized RPageInfos
397
398 /// Has the same length than fPageInfos and stores the sum of the number of elements of all the pages
399 /// up to and including a given index. Used for binary search in Find().
400 std::vector<ROOT::NTupleSize_t> fCumulativeNElements;
401
403 std::vector<RPageInfo> fPageInfos;
404
405 public:
406 RPageRange() = default;
407 RPageRange(const RPageRange &other) = delete;
411
413 {
414 RPageRange clone;
416 clone.fPageInfos = fPageInfos;
418 return clone;
419 }
420
421 /// Find the page in the RPageRange that contains the given element. The element must exist.
423
426
427 const std::vector<RPageInfo> &GetPageInfos() const { return fPageInfos; }
428 std::vector<RPageInfo> &GetPageInfos() { return fPageInfos; }
429
430 bool operator==(const RPageRange &other) const
431 {
432 return fPhysicalColumnId == other.fPhysicalColumnId && fPageInfos == other.fPageInfos;
433 }
434 };
435
436private:
438 /// Clusters can be swapped by adjusting the entry offsets of the cluster and all ranges
441
442 std::unordered_map<ROOT::DescriptorId_t, RColumnRange> fColumnRanges;
443 std::unordered_map<ROOT::DescriptorId_t, RPageRange> fPageRanges;
444
445public:
447
453
455
456 bool operator==(const RClusterDescriptor &other) const;
457
463 /// Returns an iterator over pairs { columnId, columnRange }. The iteration order is unspecified.
464 RColumnRangeIterable GetColumnRangeIterable() const;
466 {
467 return fColumnRanges.find(physicalId) != fColumnRanges.end();
468 }
469 std::uint64_t GetNBytesOnStorage() const;
470};
471
473private:
475
476public:
478 private:
479 using Iter_t = std::unordered_map<ROOT::DescriptorId_t, RColumnRange>::const_iterator;
480 /// The wrapped map iterator
482
483 public:
484 using iterator_category = std::forward_iterator_tag;
487 using difference_type = std::ptrdiff_t;
488 using pointer = const RColumnRange *;
489 using reference = const RColumnRange &;
490
491 RIterator(Iter_t iter) : fIter(iter) {}
493 {
494 ++fIter;
495 return *this;
496 }
497 reference operator*() { return fIter->second; }
498 pointer operator->() { return &fIter->second; }
499 bool operator!=(const iterator &rh) const { return fIter != rh.fIter; }
500 bool operator==(const iterator &rh) const { return fIter == rh.fIter; }
501 };
502
503 explicit RColumnRangeIterable(const RClusterDescriptor &desc) : fDesc(desc) {}
504
505 RIterator begin() { return RIterator{fDesc.fColumnRanges.cbegin()}; }
506 RIterator end() { return fDesc.fColumnRanges.cend(); }
507 size_t size() { return fDesc.fColumnRanges.size(); }
508};
509
510// clang-format off
511/**
512\class ROOT::RClusterGroupDescriptor
513\ingroup NTuple
514\brief Clusters are bundled in cluster groups.
515
516Very large RNTuples can contain multiple cluster groups to organize cluster metadata.
517Every RNTuple has at least one cluster group. The clusters in a cluster group are ordered
518corresponding to their first entry number.
519*/
520// clang-format on
523
524private:
526 /// The cluster IDs can be empty if the corresponding page list is not loaded.
527 /// Otherwise, cluster ids are sorted by first entry number.
528 std::vector<ROOT::DescriptorId_t> fClusterIds;
529 /// The page list that corresponds to the cluster group
531 /// Uncompressed size of the page list
532 std::uint64_t fPageListLength = 0;
533 /// The minimum first entry number of the clusters in the cluster group
534 std::uint64_t fMinEntry = 0;
535 /// Number of entries that are (partially for sharded clusters) covered by this cluster group.
536 std::uint64_t fEntrySpan = 0;
537 /// Number of clusters is always known even if the cluster IDs are not (yet) populated
538 std::uint32_t fNClusters = 0;
539
540public:
546
548 /// Creates a clone without the cluster IDs
550
551 bool operator==(const RClusterGroupDescriptor &other) const;
552
554 std::uint32_t GetNClusters() const { return fNClusters; }
556 std::uint64_t GetPageListLength() const { return fPageListLength; }
557 const std::vector<ROOT::DescriptorId_t> &GetClusterIds() const { return fClusterIds; }
558 std::uint64_t GetMinEntry() const { return fMinEntry; }
559 std::uint64_t GetEntrySpan() const { return fEntrySpan; }
560 /// A cluster group is loaded in two stages. Stage one loads only the summary information.
561 /// Stage two loads the list of cluster IDs.
562 bool HasClusterDetails() const { return !fClusterIds.empty(); }
563};
564
565/// Used in RExtraTypeInfoDescriptor
567 kInvalid,
569};
570
571// clang-format off
572/**
573\class ROOT::RExtraTypeInfoDescriptor
574\ingroup NTuple
575\brief Field specific extra type information from the header / extenstion header
576
577Currently only used by streamer fields to store RNTuple-wide list of streamer info records.
578*/
579// clang-format on
582
583private:
584 /// Specifies the meaning of the extra information
586 /// Type version the extra type information is bound to
587 std::uint32_t fTypeVersion = 0;
588 /// The type name the extra information refers to; empty for RNTuple-wide extra information
589 std::string fTypeName;
590 /// The content format depends on the content ID and may be binary
591 std::string fContent;
592
593public:
599
600 bool operator==(const RExtraTypeInfoDescriptor &other) const;
601
603
605 std::uint32_t GetTypeVersion() const { return fTypeVersion; }
606 const std::string &GetTypeName() const { return fTypeName; }
607 const std::string &GetContent() const { return fContent; }
608};
609
610// clang-format off
611/**
612\class ROOT::RNTupleDescriptor
613\ingroup NTuple
614\brief The on-storage metadata of an RNTuple
615
616Represents the on-disk (on storage) information about an RNTuple. The metadata consists of a header, a footer, and
617potentially multiple page lists.
618The header carries the RNTuple schema, i.e. the fields and the associated columns and their relationships.
619The footer carries information about one or several cluster groups and links to their page lists.
620For every cluster group, a page list envelope stores cluster summaries and page locations.
621For every cluster, it stores for every column the range of element indexes as well as a list of pages and page
622locations.
623
624The descriptor provides machine-independent (de-)serialization of headers and footers, and it provides lookup routines
625for RNTuple objects (pages, clusters, ...). It is supposed to be usable by all RPageStorage implementations.
626
627The serialization does not use standard ROOT streamers in order to not let it depend on libCore. The serialization uses
628the concept of envelopes and frames: header, footer, and page list envelopes have a preamble with a type ID and length.
629Substructures are serialized in frames and have a size and number of items (for list frames). This allows for forward
630and backward compatibility when the metadata evolves.
631*/
632// clang-format on
636
637public:
638 class RHeaderExtension;
639
640private:
641 /// The RNTuple name needs to be unique in a given storage location (file)
642 std::string fName;
643 /// Free text from the user
644 std::string fDescription;
645
647
648 std::uint64_t fNPhysicalColumns = 0; ///< Updated by the descriptor builder when columns are added
649
650 std::set<unsigned int> fFeatureFlags;
651 std::unordered_map<ROOT::DescriptorId_t, RFieldDescriptor> fFieldDescriptors;
652 std::unordered_map<ROOT::DescriptorId_t, RColumnDescriptor> fColumnDescriptors;
653
654 std::vector<RExtraTypeInfoDescriptor> fExtraTypeInfoDescriptors;
655 std::unique_ptr<RHeaderExtension> fHeaderExtension;
656
657 //// All fields above are part of the schema and are cloned when creating a new descriptor from a given one
658 //// (see CloneSchema())
659
660 std::uint16_t fVersionEpoch = 0; ///< Set by the descriptor builder when deserialized
661 std::uint16_t fVersionMajor = 0; ///< Set by the descriptor builder when deserialized
662 std::uint16_t fVersionMinor = 0; ///< Set by the descriptor builder when deserialized
663 std::uint16_t fVersionPatch = 0; ///< Set by the descriptor builder when deserialized
664
665 std::uint64_t fOnDiskHeaderSize = 0; ///< Set by the descriptor builder when deserialized
666 std::uint64_t fOnDiskHeaderXxHash3 = 0; ///< Set by the descriptor builder when deserialized
667 std::uint64_t fOnDiskFooterSize = 0; ///< Like fOnDiskHeaderSize, contains both cluster summaries and page locations
668
669 std::uint64_t fNEntries = 0; ///< Updated by the descriptor builder when the cluster groups are added
670 std::uint64_t fNClusters = 0; ///< Updated by the descriptor builder when the cluster groups are added
671
672 /// \brief The generation of the descriptor
673 ///
674 /// Once constructed by an RNTupleDescriptorBuilder, the descriptor is mostly immutable except for the set of
675 /// active page locations. During the lifetime of the descriptor, page location information for clusters
676 /// can be added or removed. When this happens, the generation should be increased, so that users of the
677 /// descriptor know that the information changed. The generation is increased, e.g., by the page source's
678 /// exclusive lock guard around the descriptor. It is used, e.g., by the descriptor cache in RNTupleReader.
679 std::uint64_t fGeneration = 0;
680
681 std::unordered_map<ROOT::DescriptorId_t, RClusterGroupDescriptor> fClusterGroupDescriptors;
682 /// References cluster groups sorted by entry range and thus allows for binary search.
683 /// Note that this list is empty during the descriptor building process and will only be
684 /// created when the final descriptor is extracted from the builder.
685 std::vector<ROOT::DescriptorId_t> fSortedClusterGroupIds;
686 /// Potentially a subset of all the available clusters
687 std::unordered_map<ROOT::DescriptorId_t, RClusterDescriptor> fClusterDescriptors;
688
689 // We don't expose this publicly because when we add sharded clusters, this interface does not make sense anymore
691
692 /// Creates a descriptor containing only the schema information about this RNTuple, i.e. all the information needed
693 /// to create a new RNTuple with the same schema as this one but not necessarily the same clustering. This is used
694 /// when merging two RNTuples.
696
697public:
698 /// All known feature flags.
699 /// Note that the flag values represent the bit _index_, not the already-bitshifted integer.
701 /// Signals that the RNTuple contains at least one deferred column that is part of a collection and was extended
702 /// (i.e. it appears in the footer). This can happen when merging two RNTuples that have the same collection field
703 /// backed by columns with different encoding, e.g. a vector<float> whose elements are represented by SplitReal32
704 /// in the first ntuple and by Real32 in the second.
705 /// Added in version 1.1.0.0 of the binary format.
707 // Insert new feature flags here, with contiguous values. If at any point a "hole" appears in the valid feature
708 // flags values, the check in RNTupleSerialize must be updated.
709
710 // End of regular feature flags
712
713 /// Reserved for forward-compatibility testing
715 };
716
717 class RColumnDescriptorIterable;
718 class RFieldDescriptorIterable;
719 class RClusterGroupDescriptorIterable;
720 class RClusterDescriptorIterable;
721 class RExtraTypeInfoDescriptorIterable;
722
723 /// Modifiers passed to CreateModel()
725 private:
726 /// If set to true, projected fields will be reconstructed as such. This will prevent the model to be used
727 /// with an RNTupleReader, but it is useful, e.g., to accurately merge data.
729 /// By default, creating a model will fail if any of the reconstructed fields contains an unknown column type
730 /// or an unknown field structural role.
731 /// If this option is enabled, the model will be created and all fields containing unknown data (directly
732 /// or indirectly) will be skipped instead.
733 bool fForwardCompatible = false;
734 /// If true, the model will be created without a default entry (bare model).
735 bool fCreateBare = false;
736 /// If true, fields with a user defined type that have no available dictionaries will be reconstructed
737 /// as record fields from the on-disk information; otherwise, they will cause an error.
739
740 public:
741 RCreateModelOptions() {} // Work around compiler bug, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88165
742
745
748
749 void SetCreateBare(bool v) { fCreateBare = v; }
750 bool GetCreateBare() const { return fCreateBare; }
751
754 };
755
756 RNTupleDescriptor() = default;
761
762 RNTupleDescriptor Clone() const;
763
764 bool operator==(const RNTupleDescriptor &other) const;
765
766 std::uint64_t GetOnDiskHeaderXxHash3() const { return fOnDiskHeaderXxHash3; }
767 std::uint64_t GetOnDiskHeaderSize() const { return fOnDiskHeaderSize; }
768 std::uint64_t GetOnDiskFooterSize() const { return fOnDiskFooterSize; }
769
786
787 RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const;
788 RFieldDescriptorIterable
790 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
791 RFieldDescriptorIterable GetFieldIterable(ROOT::DescriptorId_t fieldId) const;
792 RFieldDescriptorIterable
794 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
795
796 RFieldDescriptorIterable GetTopLevelFields() const;
797 RFieldDescriptorIterable
798 GetTopLevelFields(const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator) const;
799
800 RColumnDescriptorIterable GetColumnIterable() const;
801 RColumnDescriptorIterable GetColumnIterable(const RFieldDescriptor &fieldDesc) const;
802 RColumnDescriptorIterable GetColumnIterable(ROOT::DescriptorId_t fieldId) const;
803
804 RClusterGroupDescriptorIterable GetClusterGroupIterable() const;
805
806 RClusterDescriptorIterable GetClusterIterable() const;
807
808 RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const;
809
810 const std::string &GetName() const { return fName; }
811 const std::string &GetDescription() const { return fDescription; }
812
813 std::size_t GetNFields() const { return fFieldDescriptors.size(); }
814 std::size_t GetNLogicalColumns() const { return fColumnDescriptors.size(); }
815 std::size_t GetNPhysicalColumns() const { return fNPhysicalColumns; }
816 std::size_t GetNClusterGroups() const { return fClusterGroupDescriptors.size(); }
817 std::size_t GetNClusters() const { return fNClusters; }
818 std::size_t GetNActiveClusters() const { return fClusterDescriptors.size(); }
819 std::size_t GetNExtraTypeInfos() const { return fExtraTypeInfoDescriptors.size(); }
820
821 /// We know the number of entries from adding the cluster summaries
824
825 /// Returns the logical parent of all top-level RNTuple data fields.
829 /// Searches for a top-level field
830 ROOT::DescriptorId_t FindFieldId(std::string_view fieldName) const;
832 std::uint16_t representationIndex) const;
834 std::uint16_t representationIndex) const;
838
839 /// Walks up the parents of the field ID and returns a field name of the form a.b.c.d
840 /// In case of invalid field ID, an empty string is returned.
842
843 /// Adjust the type name of the passed RFieldDescriptor for comparison with another renormalized type name.
844 std::string GetTypeNameForComparison(const RFieldDescriptor &fieldDesc) const;
845
846 bool HasFeature(unsigned int flag) const { return fFeatureFlags.count(flag) > 0; }
847 std::vector<std::uint64_t> GetFeatureFlags() const;
848
849 /// Return header extension information; if the descriptor does not have a header extension, return `nullptr`
850 const RHeaderExtension *GetHeaderExtension() const { return fHeaderExtension.get(); }
851
852 /// Methods to load and drop cluster group details (cluster IDs and page locations)
856
857 std::uint64_t GetGeneration() const { return fGeneration; }
859
860 /// Re-create the C++ model from the stored metadata
861 std::unique_ptr<ROOT::RNTupleModel> CreateModel(const RCreateModelOptions &options = RCreateModelOptions()) const;
862 void PrintInfo(std::ostream &output) const;
863};
864
865// clang-format off
866/**
867\class ROOT::RNTupleDescriptor::RColumnDescriptorIterable
868\ingroup NTuple
869\brief Used to loop over a field's associated columns
870*/
871// clang-format on
873private:
874 /// The associated RNTuple for this range.
876 /// The descriptor ids of the columns ordered by field, representation, and column index
877 std::vector<ROOT::DescriptorId_t> fColumns = {};
878
879public:
881 private:
882 /// The enclosing range's RNTuple.
884 /// The enclosing range's descriptor id list.
885 const std::vector<ROOT::DescriptorId_t> &fColumns;
886 std::size_t fIndex = 0;
887
888 public:
889 using iterator_category = std::forward_iterator_tag;
892 using difference_type = std::ptrdiff_t;
893 using pointer = const RColumnDescriptor *;
895
896 RIterator(const RNTupleDescriptor &ntuple, const std::vector<ROOT::DescriptorId_t> &columns, std::size_t index)
898 {
899 }
901 {
902 ++fIndex;
903 return *this;
904 }
905 reference operator*() { return fNTuple.GetColumnDescriptor(fColumns.at(fIndex)); }
906 pointer operator->() { return &fNTuple.GetColumnDescriptor(fColumns.at(fIndex)); }
907 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
908 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
909 };
910
913
916 size_t size() { return fColumns.size(); }
917};
918
919// clang-format off
920/**
921\class ROOT::RNTupleDescriptor::RFieldDescriptorIterable
922\ingroup NTuple
923\brief Used to loop over a field's child fields
924*/
925// clang-format on
927private:
928 /// The associated RNTuple for this range.
930 /// The descriptor IDs of the child fields. These may be sorted using
931 /// a comparison function.
932 std::vector<ROOT::DescriptorId_t> fFieldChildren = {};
933
934public:
936 private:
937 /// The enclosing range's RNTuple.
939 /// The enclosing range's descriptor id list.
940 const std::vector<ROOT::DescriptorId_t> &fFieldChildren;
941 std::size_t fIndex = 0;
942
943 public:
944 using iterator_category = std::forward_iterator_tag;
947 using difference_type = std::ptrdiff_t;
950
951 RIterator(const RNTupleDescriptor &ntuple, const std::vector<ROOT::DescriptorId_t> &fieldChildren,
952 std::size_t index)
954 {
955 }
957 {
958 ++fIndex;
959 return *this;
960 }
961 reference operator*() { return fNTuple.GetFieldDescriptor(fFieldChildren.at(fIndex)); }
962 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
963 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
964 };
969 /// Sort the range using an arbitrary comparison function.
971 const std::function<bool(ROOT::DescriptorId_t, ROOT::DescriptorId_t)> &comparator)
972 : fNTuple(ntuple), fFieldChildren(field.GetLinkIds())
973 {
974 std::sort(fFieldChildren.begin(), fFieldChildren.end(), comparator);
975 }
978};
979
980// clang-format off
981/**
982\class ROOT::RNTupleDescriptor::RClusterGroupDescriptorIterable
983\ingroup NTuple
984\brief Used to loop over all the cluster groups of an RNTuple (in unspecified order)
985
986Enumerate all cluster group IDs from the descriptor. No specific order can be assumed.
987*/
988// clang-format on
990private:
991 /// The associated RNTuple for this range.
993
994public:
996 private:
997 /// The enclosing range's RNTuple.
999 std::size_t fIndex = 0;
1000
1001 public:
1002 using iterator_category = std::forward_iterator_tag;
1005 using difference_type = std::ptrdiff_t;
1008
1011 {
1012 ++fIndex;
1013 return *this;
1014 }
1016 {
1017 auto it = fNTuple.fClusterGroupDescriptors.begin();
1018 std::advance(it, fIndex);
1019 return it->second;
1020 }
1021 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
1022 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
1023 };
1024
1027 RIterator end() { return RIterator(fNTuple, fNTuple.GetNClusterGroups()); }
1028};
1029
1030// clang-format off
1031/**
1032\class ROOT::RNTupleDescriptor::RClusterDescriptorIterable
1033\ingroup NTuple
1034\brief Used to loop over all the clusters of an RNTuple (in unspecified order)
1035
1036Enumerate all cluster IDs from all cluster descriptors. No specific order can be assumed, use
1037RNTupleDescriptor::FindNextClusterId() and RNTupleDescriptor::FindPrevClusterId() to traverse
1038clusters by entry number.
1039*/
1040// clang-format on
1042private:
1043 /// The associated RNTuple for this range.
1045
1046public:
1048 private:
1049 /// The enclosing range's RNTuple.
1051 std::size_t fIndex = 0;
1052
1053 public:
1054 using iterator_category = std::forward_iterator_tag;
1057 using difference_type = std::ptrdiff_t;
1060
1063 {
1064 ++fIndex;
1065 return *this;
1066 }
1068 {
1069 auto it = fNTuple.fClusterDescriptors.begin();
1070 std::advance(it, fIndex);
1071 return it->second;
1072 }
1073 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
1074 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
1075 };
1076
1079 RIterator end() { return RIterator(fNTuple, fNTuple.GetNActiveClusters()); }
1080};
1081
1082// clang-format off
1083/**
1084\class ROOT::RNTupleDescriptor::RExtraTypeInfoDescriptorIterable
1085\ingroup NTuple
1086\brief Used to loop over all the extra type info record of an RNTuple (in unspecified order)
1087*/
1088// clang-format on
1090private:
1091 /// The associated RNTuple for this range.
1093
1094public:
1096 private:
1097 /// The enclosing range's RNTuple.
1099 std::size_t fIndex = 0;
1100
1101 public:
1102 using iterator_category = std::forward_iterator_tag;
1105 using difference_type = std::ptrdiff_t;
1108
1111 {
1112 ++fIndex;
1113 return *this;
1114 }
1116 {
1117 auto it = fNTuple.fExtraTypeInfoDescriptors.begin();
1118 std::advance(it, fIndex);
1119 return *it;
1120 }
1121 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
1122 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
1123 };
1124
1127 RIterator end() { return RIterator(fNTuple, fNTuple.GetNExtraTypeInfos()); }
1128};
1129
1130// clang-format off
1131/**
1132\class ROOT::RNTupleDescriptor::RHeaderExtension
1133\ingroup NTuple
1134\brief Summarizes information about fields and the corresponding columns that were added after the header has been serialized
1135*/
1136// clang-format on
1139
1140private:
1141 /// All field IDs of late model extensions, in the order of field addition. This is necessary to serialize the
1142 /// the fields in that order.
1143 std::vector<ROOT::DescriptorId_t> fFieldIdsOrder;
1144 /// All field IDs of late model extensions for efficient lookup. When a column gets added to the extension
1145 /// header, this enables us to determine if the column belongs to a field of the header extension of if it
1146 /// belongs to a field of the regular header that gets extended by additional column representations.
1147 std::unordered_set<ROOT::DescriptorId_t> fFieldIdsLookup;
1148 /// All logical column IDs of columns that extend, with additional column representations, fields of the regular
1149 /// header. During serialization, these columns are not picked up as columns of `fFieldIdsOrder`. But instead
1150 /// these columns need to be serialized in the extension header without re-serializing the field.
1151 std::vector<ROOT::DescriptorId_t> fExtendedColumnRepresentations;
1152 /// Number of logical and physical columns; updated by the descriptor builder when columns are added
1153 std::uint32_t fNLogicalColumns = 0;
1154 std::uint32_t fNPhysicalColumns = 0;
1155
1156 /// Marks `fieldDesc` as an extended field, i.e. a field that appears in the Header Extension (e.g. having been added
1157 /// through late model extension). Note that the field descriptor should also have been added to the RNTuple
1158 /// Descriptor alongside non-extended fields.
1160 {
1161 fFieldIdsOrder.emplace_back(fieldDesc.GetId());
1162 fFieldIdsLookup.insert(fieldDesc.GetId());
1163 }
1164
1165 /// Marks `columnDesc` as an extended column, i.e. a column that appears in the Header Extension (e.g. having been
1166 /// added through late model extension as an additional representation of an existing column). Note that the column
1167 /// descriptor should also have been added to the RNTuple Descriptor alongside non-extended columns.
1169 {
1171 if (!columnDesc.IsAliasColumn())
1173 if (fFieldIdsLookup.count(columnDesc.GetFieldId()) == 0) {
1174 fExtendedColumnRepresentations.emplace_back(columnDesc.GetLogicalId());
1175 }
1176 }
1177
1178public:
1179 std::size_t GetNFields() const { return fFieldIdsOrder.size(); }
1180 std::size_t GetNLogicalColumns() const { return fNLogicalColumns; }
1181 std::size_t GetNPhysicalColumns() const { return fNPhysicalColumns; }
1182 const std::vector<ROOT::DescriptorId_t> &GetExtendedColumnRepresentations() const
1183 {
1185 }
1186 /// Return a vector containing the IDs of the top-level fields defined in the extension header, in the order
1187 /// of their addition.
1188 /// We cannot create this vector when building the fFields because at the time when AddExtendedField is called,
1189 /// the field is not yet linked into the schema tree.
1190 std::vector<ROOT::DescriptorId_t> GetTopLevelFields(const RNTupleDescriptor &desc) const;
1191
1193 {
1194 return fFieldIdsLookup.find(fieldId) != fFieldIdsLookup.end();
1195 }
1201};
1202
1203namespace Internal {
1204
1205// clang-format off
1206/**
1207\class ROOT::Internal::RColumnDescriptorBuilder
1208\ingroup NTuple
1209\brief A helper class for piece-wise construction of an RColumnDescriptor
1210
1211Dangling column descriptors can become actual descriptors when added to an
1212RNTupleDescriptorBuilder instance and then linked to their fields.
1213*/
1214// clang-format on
1216private:
1218
1219public:
1220 /// Make an empty column descriptor builder.
1222
1234 {
1236 return *this;
1237 }
1239 {
1240 fColumn.fType = type;
1241 return *this;
1242 }
1249 {
1251 return *this;
1252 }
1270 RColumnDescriptorBuilder &ValueRange(double min, double max)
1271 {
1272 fColumn.fValueRange = {min, max};
1273 return *this;
1274 }
1275 RColumnDescriptorBuilder &ValueRange(std::optional<RColumnDescriptor::RValueRange> valueRange)
1276 {
1278 return *this;
1279 }
1282 /// Attempt to make a column descriptor. This may fail if the column
1283 /// was not given enough information to make a proper descriptor.
1285};
1286
1287// clang-format off
1288/**
1289\class ROOT::Internal::RFieldDescriptorBuilder
1290\ingroup NTuple
1291\brief A helper class for piece-wise construction of an RFieldDescriptor
1292
1293Dangling field descriptors describe a single field in isolation. They are
1294missing the necessary relationship information (parent field, any child fields)
1295required to describe a real RNTuple field.
1296
1297Dangling field descriptors can only become actual descriptors when added to an
1298RNTupleDescriptorBuilder instance and then linked to other fields.
1299*/
1300// clang-format on
1302private:
1304
1305public:
1306 /// Make an empty dangling field descriptor.
1308 /// Make a new RFieldDescriptorBuilder based off an existing descriptor.
1309 /// Relationship information is lost during the conversion to a
1310 /// dangling descriptor:
1311 /// * Parent id is reset to an invalid id.
1312 /// * Field children ids are forgotten.
1313 ///
1314 /// These properties must be set using RNTupleDescriptorBuilder::AddFieldLink().
1316
1317 /// Make a new RFieldDescriptorBuilder based off a live RNTuple field.
1319
1326 {
1328 return *this;
1329 }
1331 {
1333 return *this;
1334 }
1336 {
1338 return *this;
1339 }
1346 {
1348 return *this;
1349 }
1351 {
1353 return *this;
1354 }
1355 RFieldDescriptorBuilder &TypeName(const std::string &typeName)
1356 {
1357 fField.fTypeName = typeName;
1358 return *this;
1359 }
1361 {
1363 return *this;
1364 }
1366 {
1368 return *this;
1369 }
1371 {
1372 fField.fStructure = structure;
1373 return *this;
1374 }
1375 RFieldDescriptorBuilder &TypeChecksum(const std::optional<std::uint32_t> typeChecksum)
1376 {
1378 return *this;
1379 }
1381 /// Attempt to make a field descriptor. This may fail if the dangling field
1382 /// was not given enough information to make a proper descriptor.
1384};
1385
1386// clang-format off
1387/**
1388\class ROOT::Internal::RClusterDescriptorBuilder
1389\ingroup NTuple
1390\brief A helper class for piece-wise construction of an RClusterDescriptor
1391
1392The cluster descriptor builder starts from a summary-only cluster descriptor and allows for the
1393piecewise addition of page locations.
1394*/
1395// clang-format on
1397private:
1399
1400public:
1406
1412
1414 {
1416 return *this;
1417 }
1418
1421
1422 /// Books the given column ID as being suppressed in this cluster. The correct first element index and number of
1423 /// elements need to be set by CommitSuppressedColumnRanges() once all the calls to CommitColumnRange() and
1424 /// MarkSuppressedColumnRange() took place.
1426
1427 /// Sets the first element index and number of elements for all the suppressed column ranges.
1428 /// The information is taken from the corresponding columns from the primary representation.
1429 /// Needs to be called when all the columns (suppressed and regular) where added.
1431
1432 /// Add column and page ranges for columns created during late model extension missing in this cluster. The locator
1433 /// type for the synthesized page ranges is `kTypePageZero`. All the page sources must be able to populate the
1434 /// 'zero' page from such locator. Any call to CommitColumnRange() and CommitSuppressedColumnRanges()
1435 /// should happen before calling this function.
1437
1442
1443 /// Move out the full cluster descriptor including page locations
1445};
1446
1447// clang-format off
1448/**
1449\class ROOT::Internal::RClusterGroupDescriptorBuilder
1450\ingroup NTuple
1451\brief A helper class for piece-wise construction of an RClusterGroupDescriptor
1452*/
1453// clang-format on
1455private:
1457
1458public:
1461
1478 {
1480 return *this;
1481 }
1483 {
1485 return *this;
1486 }
1488 {
1490 return *this;
1491 }
1492 void AddSortedClusters(const std::vector<ROOT::DescriptorId_t> &clusterIds)
1493 {
1494 if (clusterIds.size() != fClusterGroup.GetNClusters())
1495 throw RException(R__FAIL("mismatch of number of clusters"));
1497 }
1498
1500};
1501
1502// clang-format off
1503/**
1504\class ROOT::Internal::RExtraTypeInfoDescriptorBuilder
1505\ingroup NTuple
1506\brief A helper class for piece-wise construction of an RExtraTypeInfoDescriptor
1507*/
1508// clang-format on
1510private:
1512
1513public:
1515
1522 {
1524 return *this;
1525 }
1526 RExtraTypeInfoDescriptorBuilder &TypeName(const std::string &typeName)
1527 {
1528 fExtraTypeInfo.fTypeName = typeName;
1529 return *this;
1530 }
1532 {
1534 return *this;
1535 }
1536
1538};
1539
1540// clang-format off
1541/**
1542\class ROOT::Internal::RNTupleDescriptorBuilder
1543\ingroup NTuple
1544\brief A helper class for piece-wise construction of an RNTupleDescriptor
1545
1546Used by RPageStorage implementations in order to construct the RNTupleDescriptor from the various header parts.
1547*/
1548// clang-format on
1550private:
1553
1554public:
1555 /// Checks whether invariants hold:
1556 /// * RNTuple epoch is valid
1557 /// * RNTuple name is valid
1558 /// * Fields have valid parents
1559 /// * Number of columns is constant across column representations
1563
1564 /// Copies the "schema" part of `descriptor` into the builder's descriptor.
1565 /// This resets the builder's descriptor.
1567
1568 void SetVersion(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor,
1569 std::uint16_t versionPatch);
1570 void SetVersionForWriting();
1571
1572 void SetNTuple(const std::string_view name, const std::string_view description);
1573 void SetFeature(unsigned int flag);
1574
1577 /// The real footer size also include the page list envelopes
1579
1580 void AddField(const RFieldDescriptor &fieldDesc);
1583
1584 // The field that the column belongs to has to be already available. For fields with multiple columns,
1585 // the columns need to be added in order of the column index
1587
1590
1593
1594 /// Clears so-far stored clusters, fields, and columns and return to a pristine RNTupleDescriptor
1595 void Reset();
1596
1597 /// Mark the beginning of the header extension; any fields and columns added after a call to this function are
1598 /// annotated as begin part of the header extension.
1599 void BeginHeaderExtension();
1600
1601 /// \brief Shift column IDs of alias columns by `offset`
1602 ///
1603 /// If the descriptor is constructed in pieces consisting of physical and alias columns
1604 /// (regular and projected fields), the natural column order would be
1605 /// - Physical and alias columns of piece one
1606 /// - Physical and alias columns of piece two
1607 /// - etc.
1608 /// What we want, however, are first all physical column IDs and then all alias column IDs.
1609 /// This method adds `offset` to the logical column IDs of all alias columns and fixes up the corresponding
1610 /// column IDs in the projected field descriptors. In this way, a new piece of physical and alias columns can
1611 /// first shift the existing alias columns by the number of new physical columns, resulting in the following order
1612 /// - Physical columns of piece one
1613 /// - Physical columns of piece two
1614 /// - ...
1615 // - Logical columns of piece one
1616 /// - Logical columns of piece two
1617 /// - ...
1618 void ShiftAliasColumns(std::uint32_t offset);
1619};
1620
1622{
1623 return desc.CloneSchema();
1624}
1625
1626} // namespace Internal
1627} // namespace ROOT
1628
1629#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:299
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)
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::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
EFeatureFlags
All known feature flags.
@ kFeatureFlag_Test
Reserved for forward-compatibility testing.
@ kFeatureFlag_NestedDeferredColumns
Signals that the RNTuple contains at least one deferred column that is part of a collection and was e...
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
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)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
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 ntuple model tree can carry different structural information about the type system.
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()