70std::unique_ptr<ROOT::RFieldBase>
74 auto streamerField = std::make_unique<ROOT::RStreamerField>(GetFieldName(), GetTypeName());
83 auto invalidField = std::make_unique<ROOT::RInvalidField>(GetFieldName(), GetTypeName(),
"",
88 throw RException(
R__FAIL(
"unexpected on-disk field structure value for field \"" + GetFieldName() +
"\""));
93 if (GetTypeName().empty()) {
94 switch (GetStructure()) {
96 std::vector<std::unique_ptr<ROOT::RFieldBase>>
memberFields;
98 for (
auto id : fLinkIds) {
110 if (fLinkIds.size() != 1) {
111 throw RException(
R__FAIL(
"unsupported untyped collection for field \"" + GetFieldName() +
"\""));
120 default:
throw RException(
R__FAIL(
"unsupported untyped field structure for field \"" + GetFieldName() +
"\""));
126 const auto &typeName = GetTypeAlias().empty() ? GetTypeName() : GetTypeAlias();
131 field->SetOnDiskId(fFieldId);
146 return std::make_unique<ROOT::RInvalidField>(GetFieldName(), GetTypeName(),
ex.GetError().GetReport(),
159 if (fTypeName.empty())
163 if (fTypeName.compare(0, 10,
"std::pair<") == 0)
165 if (fTypeName.compare(0, 11,
"std::tuple<") == 0)
176 if (fTypeName.rfind(
"std::", 0) == 0)
183 static const std::string
gIntTypeNames[] = {
"bool",
"char",
"std::int8_t",
"std::uint8_t",
184 "std::int16_t",
"std::uint16_t",
"std::int32_t",
"std::uint32_t",
185 "std::int64_t",
"std::uint64_t"};
194 return fLogicalColumnId ==
other.fLogicalColumnId && fPhysicalColumnId ==
other.fPhysicalColumnId &&
195 fBitsOnStorage ==
other.fBitsOnStorage && fType ==
other.fType && fFieldId ==
other.fFieldId &&
196 fIndex ==
other.fIndex && fRepresentationIndex ==
other.fRepresentationIndex &&
197 fValueRange ==
other.fValueRange;
220 const auto N = fCumulativeNElements.size();
224 std::size_t left = 0;
225 std::size_t right =
N - 1;
227 while (left <= right) {
257 std::accumulate(fPageInfos.begin(), fPageInfos.end(), 0U,
258 [](std::size_t
n,
const auto &
pageInfo) { return n + pageInfo.GetNElements(); });
281 std::make_move_iterator(fPageInfos.end()));
288 return fClusterId ==
other.fClusterId && fFirstEntryIndex ==
other.fFirstEntryIndex &&
289 fNEntries ==
other.fNEntries && fColumnRanges ==
other.fColumnRanges && fPageRanges ==
other.fPageRanges;
295 for (
const auto &
pr : fPageRanges) {
296 for (
const auto &pi :
pr.second.GetPageInfos()) {
297 nbytes += pi.GetLocator().GetNBytesOnStorage();
310 for (
const auto &
d : fPageRanges)
319 return fContentId ==
other.fContentId && fTypeName ==
other.fTypeName && fTypeVersion ==
other.fTypeVersion;
337 return fName ==
other.fName &&
338 fDescription ==
other.fDescription &&
339 fNEntries ==
other.fNEntries &&
340 fGeneration ==
other.fGeneration &&
341 fFieldZeroId ==
other.fFieldZeroId &&
342 fFieldDescriptors ==
other.fFieldDescriptors &&
343 fColumnDescriptors ==
other.fColumnDescriptors &&
344 fClusterGroupDescriptors ==
other.fClusterGroupDescriptors &&
345 fClusterDescriptors ==
other.fClusterDescriptors;
352 for (
const auto &cd : fClusterDescriptors) {
363std::vector<ROOT::Internal::RNTupleClusterBoundaries>
366 std::vector<Internal::RNTupleClusterBoundaries> boundaries;
384 if (
posDot != std::string::npos) {
413 std::string typeName =
fieldDesc.GetTypeName();
417 if (fVersionMajor == 0 && fVersionMinor == 0 && fVersionPatch < 1) {
426 return FindFieldId(
fieldName, GetFieldZeroId());
434 if (
itr == fFieldDescriptors.cend())
439 if (
itr->second.GetLogicalColumnIds().size() <= idx)
441 return itr->second.GetLogicalColumnIds()[idx];
451 return GetColumnDescriptor(
logicalId).GetPhysicalId();
457 if (GetNClusterGroups() == 0)
463 std::size_t
cgRight = GetNClusterGroups() - 1;
466 const auto &
clusterIds = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]).GetClusterIds();
519 if (GetNClusterGroups() == 0)
525 std::size_t
cgRight = GetNClusterGroups() - 1;
528 const auto &
cgDesc = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]);
589 return FindClusterId(
clusterDesc.GetFirstEntryIndex() - 1);
592std::vector<ROOT::DescriptorId_t>
597 std::vector<ROOT::DescriptorId_t>
fields;
598 for (
const auto fieldId : fFieldIdsOrder) {
607 : fNTuple(
ntuple), fColumns(
field.GetLogicalColumnIds())
632 std::vector<std::uint64_t>
result;
633 unsigned int base = 0;
634 std::uint64_t flags = 0;
636 if ((
f > 0) && ((
f % 64) == 0))
638 while (
f > base + 64) {
639 result.emplace_back(flags);
646 result.emplace_back(flags);
655 return R__FAIL(
"invalid attempt to add details of unknown cluster group");
656 if (iter->second.HasClusterDetails())
657 return R__FAIL(
"invalid attempt to re-populate cluster group details");
659 return R__FAIL(
"mismatch of number of clusters");
666 return R__FAIL(
"invalid attempt to re-populate existing cluster");
670 return fClusterDescriptors[a].GetFirstEntryIndex() < fClusterDescriptors[b].GetFirstEntryIndex();
674 iter->second =
cgBuilder.MoveDescriptor().Unwrap();
682 return R__FAIL(
"invalid attempt to drop cluster details of unknown cluster group");
683 if (!iter->second.HasClusterDetails())
684 return R__FAIL(
"invalid attempt to drop details of cluster group summary");
686 for (
auto clusterId : iter->second.GetClusterIds())
688 iter->second = iter->second.CloneSummary();
716 "cannot create Model: descriptor contains unknown column types. Use 'SetForwardCompatible(true)' on the "
717 "RCreateModelOptions to create a partial model containing only the fields made up by known columns."));
719 auto fieldZero = std::make_unique<ROOT::RFieldZero>();
740 const auto cat =
invalid.GetCategory();
750 model->AddProjectedField(std::move(
field), [
this](
const std::string &
targetName) -> std::string {
754 model->AddField(std::move(
field));
813 return fClusterGroupId ==
other.fClusterGroupId && fClusterIds ==
other.fClusterIds &&
845 return R__FAIL(
"column ID mismatch");
846 if (fCluster.fColumnRanges.count(
physicalId) > 0)
847 return R__FAIL(
"column ID conflict");
849 for (
const auto &pi :
pageRange.fPageInfos) {
860 if (fCluster.fColumnRanges.count(
physicalId) > 0)
861 return R__FAIL(
"column ID conflict");
899 return R__FAIL(std::string(
"cannot find non-suppressed column for column ID ") +
900 std::to_string(
columnRange.GetPhysicalColumnId()) +
901 ", cluster ID: " + std::to_string(fCluster.GetId()));
932 for (const auto &c : desc.GetColumnIterable(fieldId)) {
933 const ROOT::DescriptorId_t physicalId = c.GetPhysicalId();
934 auto &columnRange = fCluster.fColumnRanges[physicalId];
939 if (columnRange.GetPhysicalColumnId() == ROOT::kInvalidDescriptorId) {
940 columnRange.SetPhysicalColumnId(physicalId);
941 columnRange.SetFirstElementIndex(0);
942 columnRange.SetNElements(0);
943 columnRange.SetIsSuppressed(c.IsSuppressedDeferredColumn());
951 if (c.IsDeferredColumn()) {
952 columnRange.SetFirstElementIndex(fCluster.GetFirstEntryIndex() * nRepetitions);
953 columnRange.SetNElements(fCluster.GetNEntries() * nRepetitions);
954 if (!columnRange.IsSuppressed()) {
955 auto &pageRange = fCluster.fPageRanges[physicalId];
956 pageRange.fPhysicalColumnId = physicalId;
957 const auto element = ROOT::Internal::RColumnElementBase::Generate<void>(c.GetType());
958 pageRange.ExtendToFitColumnRange(columnRange, *element, ROOT::Internal::RPage::kPageZeroSize);
960 } else if (!columnRange.IsSuppressed()) {
961 fCluster.fPageRanges[physicalId].fPhysicalColumnId = physicalId;
973 return R__FAIL(
"unset cluster ID");
974 if (fCluster.fNEntries == 0)
975 return R__FAIL(
"empty cluster");
976 for (
auto &
pr : fCluster.fPageRanges) {
977 if (fCluster.fColumnRanges.count(
pr.first) == 0) {
978 return R__FAIL(
"missing column range");
980 pr.second.fCumulativeNElements.clear();
981 pr.second.fCumulativeNElements.reserve(
pr.second.fPageInfos.size());
983 for (
const auto &pi :
pr.second.fPageInfos) {
984 sum += pi.GetNElements();
985 pr.second.fCumulativeNElements.emplace_back(
sum);
989 std::swap(
result, fCluster);
1011 return R__FAIL(
"unset cluster group ID");
1013 std::swap(
result, fClusterGroup);
1024 std::swap(
result, fExtraTypeInfo);
1032 if (fDescriptor.fFieldDescriptors.count(
fieldId) == 0)
1033 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' doesn't exist");
1040 return R__FAIL(
"unset or unsupported RNTuple epoch version");
1052 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has an invalid parent id");
1070 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has incomplete column representations");
1078 EnsureValidDescriptor().ThrowOnError();
1080 for (
const auto &[
id,
_] : fDescriptor.fClusterGroupDescriptors)
1081 fDescriptor.fSortedClusterGroupIds.emplace_back(
id);
1082 std::sort(fDescriptor.fSortedClusterGroupIds.begin(), fDescriptor.fSortedClusterGroupIds.end(),
1084 return fDescriptor.fClusterGroupDescriptors[a].GetMinEntry() <
1085 fDescriptor.fClusterGroupDescriptors[b].GetMinEntry();
1088 std::swap(
result, fDescriptor);
1115 fDescriptor.fName = std::string(
name);
1116 fDescriptor.fDescription = std::string(
description);
1123 fDescriptor.fFeatureFlags.insert(
flag);
1129 return R__FAIL(
"invalid logical column id");
1131 return R__FAIL(
"invalid physical column id");
1133 return R__FAIL(
"invalid field id, dangling column");
1142 if (fColumn.GetBitsOnStorage() <
minBits || fColumn.GetBitsOnStorage() >
maxBits)
1143 return R__FAIL(
"invalid column bit width");
1146 return fColumn.Clone();
1154 .TypeVersion(
field.GetTypeVersion())
1155 .FieldName(
field.GetFieldName())
1156 .FieldDescription(
field.GetDescription())
1157 .TypeName(
field.GetTypeName())
1158 .TypeAlias(
field.GetTypeAlias())
1159 .Structure(
field.GetStructure())
1160 .NRepetitions(
field.GetNRepetitions());
1169 return R__FAIL(
"invalid field id");
1172 return R__FAIL(
"invalid field structure");
1180 if (fField.GetFieldName().empty()) {
1181 return R__FAIL(
"name cannot be empty string \"\"");
1184 return fField.Clone();
1190 if (fDescriptor.fHeaderExtension)
1191 fDescriptor.fHeaderExtension->MarkExtendedField(
fieldDesc);
1193 fDescriptor.fFieldZeroId =
fieldDesc.GetId();
1204 return R__FAIL(
"child field with id '" + std::to_string(
linkId) +
"' doesn't exist in NTuple");
1206 if (
linkId == fDescriptor.GetFieldZeroId()) {
1207 return R__FAIL(
"cannot make FieldZero a child field");
1210 auto parentId = fDescriptor.fFieldDescriptors.at(
linkId).GetParentId();
1212 return R__FAIL(
"field '" + std::to_string(
linkId) +
"' already has a parent ('" + std::to_string(
parentId) +
")");
1215 return R__FAIL(
"cannot make field '" + std::to_string(
fieldId) +
"' a child of itself");
1217 fDescriptor.fFieldDescriptors.at(
linkId).fParentId =
fieldId;
1218 fDescriptor.fFieldDescriptors.at(
fieldId).fLinkIds.push_back(
linkId);
1229 return R__FAIL(
"projected field with id '" + std::to_string(
targetId) +
"' doesn't exist in NTuple");
1231 if (
targetId == fDescriptor.GetFieldZeroId()) {
1232 return R__FAIL(
"cannot make FieldZero a projected field");
1235 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of itself");
1237 if (fDescriptor.fFieldDescriptors.at(
sourceId).IsProjectedField()) {
1238 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of an already projected field");
1243 return R__FAIL(
"field '" + std::to_string(
targetId) +
"' has already a projection source ('" +
1244 std::to_string(
targetDesc.GetProjectionSourceId()) +
")");
1263 if (
columnDesc.GetType() != fDescriptor.GetColumnDescriptor(
columnDesc.GetPhysicalId()).GetType())
1264 return R__FAIL(
"alias column type mismatch");
1267 return R__FAIL(
"column index clash");
1271 return R__FAIL(
"out of bounds column index");
1275 return R__FAIL(
"out of bounds representation index");
1281 return R__FAIL(
"incomplete column representations");
1285 return R__FAIL(
"irregular column representations");
1296 fDescriptor.fNPhysicalColumns++;
1298 if (fDescriptor.fHeaderExtension)
1299 fDescriptor.fHeaderExtension->MarkExtendedColumn(
columnDesc);
1307 if (fDescriptor.fClusterGroupDescriptors.count(
id) > 0)
1308 return R__FAIL(
"cluster group id clash");
1311 fDescriptor.fClusterGroupDescriptors.emplace(
id, std::move(
clusterGroup));
1322 if (!fDescriptor.fHeaderExtension)
1323 fDescriptor.fHeaderExtension = std::make_unique<RNTupleDescriptor::RHeaderExtension>();
1328 if (fDescriptor.GetNLogicalColumns() == 0)
1330 R__ASSERT(fDescriptor.GetNPhysicalColumns() > 0);
1332 for (
ROOT::DescriptorId_t id = fDescriptor.GetNLogicalColumns() - 1;
id >= fDescriptor.GetNPhysicalColumns(); --
id) {
1333 auto c = fDescriptor.fColumnDescriptors[
id].Clone();
1336 fDescriptor.fColumnDescriptors.erase(
id);
1337 for (
auto &
link : fDescriptor.fFieldDescriptors[
c.fFieldId].fLogicalColumnIds) {
1338 if (
link ==
c.fLogicalColumnId) {
1344 R__ASSERT(fDescriptor.fColumnDescriptors.count(
c.fLogicalColumnId) == 0);
1345 fDescriptor.fColumnDescriptors.emplace(
c.fLogicalColumnId, std::move(
c));
1352 if (fDescriptor.fClusterDescriptors.count(
clusterId) > 0)
1353 return R__FAIL(
"cluster id clash");
1362 if (std::find(fDescriptor.fExtraTypeInfoDescriptors.begin(), fDescriptor.fExtraTypeInfoDescriptors.end(),
1364 return R__FAIL(
"extra type info duplicates");
1366 fDescriptor.fExtraTypeInfoDescriptors.emplace_back(std::move(
extraTypeInfoDesc));
1372 auto it = std::find(fDescriptor.fExtraTypeInfoDescriptors.begin(), fDescriptor.fExtraTypeInfoDescriptors.end(),
1374 if (it != fDescriptor.fExtraTypeInfoDescriptors.end())
1377 fDescriptor.fExtraTypeInfoDescriptors.emplace_back(std::move(
extraTypeInfoDesc));
1383 const auto &desc = GetDescriptor();
1410 for (
const auto &
extraTypeInfo : desc.GetExtraTypeInfoIterable()) {
#define R__FORWARD_ERROR(res)
Short-hand to return an RResult<T> in an error state (i.e. after checking)
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
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.
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 Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
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
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.
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.
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)
RResult< RClusterGroupDescriptor > MoveDescriptor()
RClusterGroupDescriptorBuilder & ClusterGroupId(ROOT::DescriptorId_t clusterGroupId)
RClusterGroupDescriptorBuilder & NClusters(std::uint32_t nClusters)
RResult< RColumnDescriptor > MakeDescriptor() const
Attempt to make a column descriptor.
A column element encapsulates the translation between basic C++ types and their column representation...
static std::pair< std::uint16_t, std::uint16_t > GetValidBitRange(ROOT::ENTupleColumnType type)
Most types have a fixed on-disk bit width.
A helper class for piece-wise construction of an RFieldDescriptor.
RResult< RFieldDescriptor > MakeDescriptor() const
Attempt to make a field descriptor.
static RFieldDescriptorBuilder FromField(const ROOT::RFieldBase &field)
Make a new RFieldDescriptorBuilder based off a live RNTuple field.
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.
void SetVersionForWriting()
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)
RNTupleDescriptor MoveDescriptor()
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)
RResult< void > EnsureFieldExists(ROOT::DescriptorId_t fieldId) const
void SetFeature(unsigned int flag)
A helper class for serializing and deserialization of the RNTuple binary format.
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
static RResult< StreamerInfoMap_t > DeserializeStreamerInfos(const std::string &extraTypeInfoContent)
The window of element indexes of a particular column in a particular cluster.
Metadata for RNTuple clusters.
ROOT::NTupleSize_t fFirstEntryIndex
Clusters can be swapped by adjusting the entry offsets of the cluster and all ranges.
std::unordered_map< ROOT::DescriptorId_t, RColumnRange > fColumnRanges
ROOT::NTupleSize_t fNEntries
ROOT::DescriptorId_t fClusterId
RClusterDescriptor Clone() const
bool operator==(const RClusterDescriptor &other) const
RColumnRangeIterable GetColumnRangeIterable() const
Returns an iterator over pairs { columnId, columnRange }. The iteration order is unspecified.
std::unordered_map< ROOT::DescriptorId_t, RPageRange > fPageRanges
std::uint64_t GetNBytesOnStorage() const
Clusters are bundled in cluster groups.
RNTupleLocator fPageListLocator
The page list that corresponds to the cluster group.
RClusterGroupDescriptor Clone() const
std::vector< ROOT::DescriptorId_t > fClusterIds
The cluster IDs can be empty if the corresponding page list is not loaded.
std::uint64_t fMinEntry
The minimum first entry number of the clusters in the cluster group.
std::uint32_t fNClusters
Number of clusters is always known even if the cluster IDs are not (yet) populated.
std::uint64_t fPageListLength
Uncompressed size of the page list.
ROOT::DescriptorId_t fClusterGroupId
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.
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.
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.
std::uint32_t fIndex
A field can be serialized into several columns, which are numbered from zero to $n$.
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.
std::optional< RValueRange > fValueRange
Optional value range (used e.g. by quantized real fields)
RColumnDescriptor Clone() const
Get a copy of the descriptor.
Base class for all ROOT issued exceptions.
A field translates read and write calls from/to underlying columns to/from tree values.
@ kTraitInvalidField
This field is an instance of RInvalidField and can be safely static_cast to it.
@ kTraitTypeChecksum
The TClass checksum is set and valid.
Metadata stored for every field of an RNTuple.
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.
std::uint64_t fNRepetitions
The number of elements per entry for fixed-size arrays.
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.
bool IsCustomEnum(const RNTupleDescriptor &desc) const
Tells if the field describes a user-defined enum type.
bool operator==(const RFieldDescriptor &other) const
std::string fFieldDescription
Free text set by the user.
ROOT::DescriptorId_t fParentId
Establishes sub field relationships, such as classes and collections.
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::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.
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::vector< ROOT::DescriptorId_t > fLogicalColumnIds
The ordered list of columns attached to this field: first by representation index then by column inde...
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...
Used in RFieldBase::Check() to record field creation failures.
@ kGeneric
Generic unrecoverable error.
@ kUnknownStructure
The field could not be created because its descriptor had an unknown structural role.
Used to loop over all the clusters of an RNTuple (in unspecified order)
Used to loop over all the cluster groups of an RNTuple (in unspecified order)
Used to loop over a field's associated columns.
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)
Used to loop over a field's child fields.
The on-storage metadata of an RNTuple.
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
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.
RClusterGroupDescriptorIterable GetClusterGroupIterable() const
RColumnDescriptorIterable GetColumnIterable() const
bool operator==(const RNTupleDescriptor &other) 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::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
const RHeaderExtension * GetHeaderExtension() const
Return header extension information; if the descriptor does not have a header extension,...
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)
std::uint64_t fOnDiskHeaderSize
Set by the descriptor builder when deserialized.
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
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)
std::uint16_t fVersionPatch
Set by the descriptor builder when deserialized.
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::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....
std::uint64_t fGeneration
The generation of the descriptor.
ROOT::DescriptorId_t FindPrevClusterId(ROOT::DescriptorId_t clusterId) const
std::unique_ptr< RHeaderExtension > fHeaderExtension
Generic information about the physical location of data.
static std::unique_ptr< RNTupleModel > Create()
static std::unique_ptr< RNTupleModel > CreateBare()
Creates a "bare model", i.e. an RNTupleModel with no default entry.
static constexpr std::uint16_t kVersionPatch
static constexpr std::uint16_t kVersionMajor
static constexpr std::uint16_t kVersionEpoch
static constexpr std::uint16_t kVersionMinor
const_iterator begin() const
const_iterator end() const
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
static std::unique_ptr< RVectorField > CreateUntyped(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
RResult< void > EnsureValidNameForRNTuple(std::string_view name, std::string_view where)
Check whether a given string is a valid name according to the RNTuple specification.
ROOT::RResult< std::unique_ptr< ROOT::RFieldBase > > CallFieldBaseCreate(const std::string &fieldName, const std::string &typeName, const ROOT::RCreateFieldOptions &options, const ROOT::RNTupleDescriptor *desc, ROOT::DescriptorId_t fieldId)
std::vector< ROOT::Internal::RNTupleClusterBoundaries > GetClusterBoundaries(const RNTupleDescriptor &desc)
Return the cluster boundaries for each cluster in this RNTuple.
std::string GetRenormalizedTypeName(const std::string &metaNormalizedName)
Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
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
Additional information about a page in an in-memory RPageRange.
Information about a single page in the context of a cluster's page range.
bool GetReturnInvalidOnError() const
Modifiers passed to CreateModel()
bool GetCreateBare() const
bool GetEmulateUnknownTypes() const
bool GetReconstructProjections() const
bool GetForwardCompatible() const
static uint64_t sum(uint64_t i)