43 return fFieldId ==
other.fFieldId && fFieldVersion ==
other.fFieldVersion && fTypeVersion ==
other.fTypeVersion &&
44 GetFieldName() ==
other.GetFieldName() && GetFieldDescription() ==
other.GetFieldDescription() &&
45 GetTypeName() ==
other.GetTypeName() && GetTypeAlias() ==
other.GetTypeAlias() &&
46 fNRepetitions ==
other.fNRepetitions && fStructure ==
other.fStructure && fParentId ==
other.fParentId &&
47 fProjectionSourceId ==
other.fProjectionSourceId && fLinkIds ==
other.fLinkIds &&
48 fLogicalColumnIds ==
other.fLogicalColumnIds && fTypeChecksum ==
other.fTypeChecksum &&
49 fIsSoACollection ==
other.fIsSoACollection;
54 fFieldId =
source.fFieldId;
55 fFieldVersion =
source.fFieldVersion;
56 fTypeVersion =
source.fTypeVersion;
57 fNRepetitions =
source.fNRepetitions;
58 fStructure =
source.fStructure;
59 fParentId =
source.fParentId;
60 fProjectionSourceId =
source.fProjectionSourceId;
61 fLinkIds =
source.fLinkIds;
62 fColumnCardinality =
source.fColumnCardinality;
63 fLogicalColumnIds =
source.fLogicalColumnIds;
64 fTypeChecksum =
source.fTypeChecksum;
65 fIsSoACollection =
source.fIsSoACollection;
76 clone.
fStringPool = std::make_unique<Internal::RStringPool>();
81std::unique_ptr<ROOT::RFieldBase>
85 auto streamerField = std::make_unique<ROOT::RStreamerField>(GetFieldName(), GetTypeName());
94 auto invalidField = std::make_unique<ROOT::RInvalidField>(GetFieldName(), GetTypeName(),
"",
99 throw RException(
R__FAIL(
"unexpected on-disk field structure value for field \"" + GetFieldName() +
"\""));
104 if (GetTypeName().empty()) {
105 switch (GetStructure()) {
107 std::vector<std::unique_ptr<ROOT::RFieldBase>>
memberFields;
109 for (
auto id : fLinkIds) {
121 if (fLinkIds.size() != 1) {
122 throw RException(
R__FAIL(
"unsupported untyped collection for field \"" + GetFieldName() +
"\""));
131 default:
throw RException(
R__FAIL(
"unsupported untyped field structure for field \"" + GetFieldName() +
"\""));
137 const auto &typeName = GetTypeAlias().empty() ? GetTypeName() : GetTypeAlias();
142 field->SetOnDiskId(fFieldId);
157 return std::make_unique<ROOT::RInvalidField>(GetFieldName(), GetTypeName(),
ex.what(),
168 return fLogicalColumnId ==
other.fLogicalColumnId && fPhysicalColumnId ==
other.fPhysicalColumnId &&
169 fBitsOnStorage ==
other.fBitsOnStorage && fType ==
other.fType && fFieldId ==
other.fFieldId &&
170 fIndex ==
other.fIndex && fRepresentationIndex ==
other.fRepresentationIndex &&
171 fValueRange ==
other.fValueRange;
186 clone.
fValueRange = std::make_unique<RValueRange>(*fValueRange);
195 if (!fCumulativeNElements) {
199 for (
const auto &pi : fPageInfos) {
209 const auto N = fCumulativeNElements->size();
213 std::size_t left = 0;
214 std::size_t right =
N - 1;
216 while (left <= right) {
246 std::accumulate(fPageInfos.begin(), fPageInfos.end(), 0U,
247 [](std::size_t
n,
const auto &
pageInfo) { return n + pageInfo.GetNElements(); });
270 std::make_move_iterator(fPageInfos.end()));
277 return fClusterId ==
other.fClusterId && fFirstEntryIndex ==
other.fFirstEntryIndex &&
278 fNEntries ==
other.fNEntries && fColumnRanges ==
other.fColumnRanges && fPageRanges ==
other.fPageRanges;
284 for (
const auto &
pr : fPageRanges) {
285 for (
const auto &pi :
pr.second.GetPageInfos()) {
286 nbytes += pi.GetLocator().GetNBytesOnStorage();
299 for (
const auto &
d : fPageRanges)
308 return fContentId ==
other.fContentId && fTypeName ==
other.fTypeName && fTypeVersion ==
other.fTypeVersion;
333 return fName ==
other.fName &&
334 fDescription ==
other.fDescription &&
335 fNEntries ==
other.fNEntries &&
336 fGeneration ==
other.fGeneration &&
337 fFieldZeroId ==
other.fFieldZeroId &&
338 fFieldDescriptors ==
other.fFieldDescriptors &&
339 fColumnDescriptors ==
other.fColumnDescriptors &&
340 fClusterGroupDescriptors ==
other.fClusterGroupDescriptors &&
341 fClusterDescriptors ==
other.fClusterDescriptors;
348 for (
const auto &cd : fClusterDescriptors) {
359std::vector<ROOT::Internal::RNTupleClusterBoundaries>
362 std::vector<Internal::RNTupleClusterBoundaries> boundaries;
363 boundaries.reserve(
desc.GetNClusters());
378 if (
posDot != std::string::npos) {
408 return fVersionMajor == 0 && fVersionMinor == 0 && fVersionPatch < 1;
413 std::string typeName =
fieldDesc.GetTypeName();
415 if (FieldTypeNamesMayNeedFixup()) {
424 return FindFieldId(
fieldName, GetFieldZeroId());
432 if (
itr == fFieldDescriptors.cend())
437 if (
itr->second.GetLogicalColumnIds().size() <= idx)
439 return itr->second.GetLogicalColumnIds()[idx];
449 return GetColumnDescriptor(
logicalId).GetPhysicalId();
455 if (GetNClusterGroups() == 0)
461 std::size_t
cgRight = GetNClusterGroups() - 1;
464 const auto &
clusterIds = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]).GetClusterIds();
517 if (GetNClusterGroups() == 0)
523 std::size_t
cgRight = GetNClusterGroups() - 1;
526 const auto &
cgDesc = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]);
587 return FindClusterId(
clusterDesc.GetFirstEntryIndex() - 1);
590std::vector<ROOT::DescriptorId_t>
593 std::vector<ROOT::DescriptorId_t>
fields;
594 for (
const auto fieldId : fFieldIdsOrder) {
595 if (fFieldIdsLookup.count(
desc.GetFieldDescriptor(
fieldId).GetParentId()) == 0)
603 : fNTuple(
ntuple), fColumns(
field.GetLogicalColumnIds())
628 std::vector<std::uint64_t>
result;
629 unsigned int base = 0;
630 std::uint64_t flags = 0;
632 if ((
f > 0) && ((
f % 64) == 0))
634 while (
f > base + 64) {
635 result.emplace_back(flags);
643 flags |= std::uint64_t(1) <<
f;
645 result.emplace_back(flags);
654 return R__FAIL(
"invalid attempt to add details of unknown cluster group");
655 if (iter->second.HasClusterDetails())
656 return R__FAIL(
"invalid attempt to re-populate cluster group details");
658 return R__FAIL(
"mismatch of number of clusters");
665 return R__FAIL(
"invalid attempt to re-populate existing cluster");
669 return fClusterDescriptors[a].GetFirstEntryIndex() < fClusterDescriptors[b].GetFirstEntryIndex();
673 iter->second =
cgBuilder.MoveDescriptor().Unwrap();
681 return R__FAIL(
"invalid attempt to drop cluster details of unknown cluster group");
682 if (!iter->second.HasClusterDetails())
683 return R__FAIL(
"invalid attempt to drop details of cluster group summary");
685 for (
auto clusterId : iter->second.GetClusterIds())
687 iter->second = iter->second.CloneSummary();
715 "cannot create Model: descriptor contains unknown column types. Use 'SetForwardCompatible(true)' on the "
716 "RCreateModelOptions to create a partial model containing only the fields made up by known columns."));
718 auto fieldZero = std::make_unique<ROOT::RFieldZero>();
739 const auto cat =
invalid.GetCategory();
749 model->AddProjectedField(std::move(
field), [
this](
const std::string &
targetName) -> std::string {
753 model->AddField(std::move(
field));
835 return fClusterGroupId ==
other.fClusterGroupId && fClusterIds ==
other.fClusterIds &&
867 return R__FAIL(
"column ID mismatch");
868 if (fCluster.fColumnRanges.count(
physicalId) > 0)
869 return R__FAIL(
"column ID conflict");
871 for (
const auto &pi :
pageRange.fPageInfos) {
882 if (fCluster.fColumnRanges.count(
physicalId) > 0)
883 return R__FAIL(
"column ID conflict");
921 return R__FAIL(std::string(
"cannot find non-suppressed column for column ID ") +
922 std::to_string(
columnRange.GetPhysicalColumnId()) +
923 ", cluster ID: " + std::to_string(fCluster.GetId()));
945 if (!
desc.GetHeaderExtension())
954 for (const auto &c : desc.GetColumnIterable(fieldId)) {
955 const ROOT::DescriptorId_t physicalId = c.GetPhysicalId();
956 auto &columnRange = fCluster.fColumnRanges[physicalId];
961 if (columnRange.GetPhysicalColumnId() == ROOT::kInvalidDescriptorId) {
962 columnRange.SetPhysicalColumnId(physicalId);
963 columnRange.SetFirstElementIndex(0);
964 columnRange.SetNElements(0);
965 columnRange.SetIsSuppressed(c.IsSuppressedDeferredColumn());
970 if (c.IsDeferredColumn()) {
971 if (c.GetRepresentationIndex() == 0) {
976 columnRange.SetFirstElementIndex(fCluster.GetFirstEntryIndex() * nRepetitions);
977 columnRange.SetNElements(fCluster.GetNEntries() * nRepetitions);
984 const auto &field = desc.GetFieldDescriptor(fieldId);
985 const auto firstReprColumnId = field.GetLogicalColumnIds()[c.GetIndex()];
986 const auto &firstReprColumnRange = fCluster.fColumnRanges[firstReprColumnId];
987 columnRange.SetFirstElementIndex(firstReprColumnRange.GetFirstElementIndex());
988 columnRange.SetNElements(firstReprColumnRange.GetNElements());
990 if (!columnRange.IsSuppressed()) {
991 auto &pageRange = fCluster.fPageRanges[physicalId];
992 pageRange.fPhysicalColumnId = physicalId;
993 const auto element = ROOT::Internal::RColumnElementBase::Generate<void>(c.GetType());
994 pageRange.ExtendToFitColumnRange(columnRange, *element, ROOT::Internal::RPage::kPageZeroSize);
996 } else if (!columnRange.IsSuppressed()) {
997 fCluster.fPageRanges[physicalId].fPhysicalColumnId = physicalId;
1009 return R__FAIL(
"unset cluster ID");
1010 if (fCluster.fNEntries == 0)
1011 return R__FAIL(
"empty cluster");
1012 for (
auto &
pr : fCluster.fPageRanges) {
1013 if (fCluster.fColumnRanges.count(
pr.first) == 0) {
1014 return R__FAIL(
"missing column range");
1016 pr.second.fCumulativeNElements.reset();
1017 const auto nPages =
pr.second.fPageInfos.size();
1019 pr.second.fCumulativeNElements = std::make_unique<std::vector<NTupleSize_t>>();
1020 pr.second.fCumulativeNElements->reserve(
nPages);
1022 for (
const auto &pi :
pr.second.fPageInfos) {
1023 sum += pi.GetNElements();
1024 pr.second.fCumulativeNElements->emplace_back(
sum);
1029 std::swap(
result, fCluster);
1051 return R__FAIL(
"unset cluster group ID");
1053 std::swap(
result, fClusterGroup);
1064 std::swap(
result, fExtraTypeInfo);
1072 if (fDescriptor.fFieldDescriptors.count(
fieldId) == 0)
1073 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' doesn't exist");
1080 return R__FAIL(
"unset or unsupported RNTuple epoch version");
1092 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has an invalid parent id");
1110 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has incomplete column representations");
1118 EnsureValidDescriptor().ThrowOnError();
1120 for (
const auto &[
id,
_] : fDescriptor.fClusterGroupDescriptors)
1121 fDescriptor.fSortedClusterGroupIds.emplace_back(
id);
1122 std::sort(fDescriptor.fSortedClusterGroupIds.begin(), fDescriptor.fSortedClusterGroupIds.end(),
1124 return fDescriptor.fClusterGroupDescriptors[a].GetMinEntry() <
1125 fDescriptor.fClusterGroupDescriptors[b].GetMinEntry();
1127 fDescriptor.fStringPool->Freeze();
1129 std::swap(
result, fDescriptor);
1155 fDescriptor.fName = std::string(
name);
1156 fDescriptor.fDescription = std::string(
description);
1163 fDescriptor.fFeatureFlags.insert(
flag);
1169 if (fDesc.fName.empty())
1170 return R__FAIL(
"attribute set name cannot be empty");
1171 if (fDesc.fAnchorLength == 0)
1172 return R__FAIL(
"invalid anchor length");
1174 return R__FAIL(
"invalid locator type");
1176 return std::move(fDesc);
1182 return R__FAIL(
"invalid logical column id");
1184 return R__FAIL(
"invalid physical column id");
1186 return R__FAIL(
"invalid field id, dangling column");
1195 if (fColumn.GetBitsOnStorage() <
minBits || fColumn.GetBitsOnStorage() >
maxBits)
1196 return R__FAIL(
"invalid column bit width");
1200 std::swap(
result, fColumn);
1215 return R__FAIL(
"invalid field id");
1218 return R__FAIL(
"invalid field structure");
1221 return R__FAIL(
"invalid SoA flag on non-collection field");
1229 if (fField.GetFieldName().empty()) {
1230 return R__FAIL(
"name cannot be empty string \"\"");
1235 std::swap(
result, fField);
1243 .FieldVersion(
field.GetFieldVersion())
1244 .TypeVersion(
field.GetTypeVersion())
1245 .FieldName(
field.GetFieldName())
1246 .FieldDescription(
field.GetDescription())
1247 .TypeName(
field.GetTypeName())
1248 .TypeAlias(
field.GetTypeAlias())
1249 .Structure(
field.GetStructure())
1250 .NRepetitions(
field.GetNRepetitions());
1257 AddField(
fieldDesc.MoveDescriptor().Unwrap());
1263 if (fDescriptor.fHeaderExtension)
1264 fDescriptor.fHeaderExtension->MarkExtendedField(
fieldDesc);
1266 fDescriptor.fFieldZeroId =
id;
1269 fDescriptor.fFieldDescriptors.emplace(
id, std::move(
fieldDesc));
1279 return R__FAIL(
"child field with id '" + std::to_string(
linkId) +
"' doesn't exist in NTuple");
1281 if (
linkId == fDescriptor.GetFieldZeroId()) {
1282 return R__FAIL(
"cannot make FieldZero a child field");
1285 auto parentId = fDescriptor.fFieldDescriptors.at(
linkId).GetParentId();
1287 return R__FAIL(
"field '" + std::to_string(
linkId) +
"' already has a parent ('" + std::to_string(
parentId) +
")");
1290 return R__FAIL(
"cannot make field '" + std::to_string(
fieldId) +
"' a child of itself");
1292 fDescriptor.fFieldDescriptors.at(
linkId).fParentId =
fieldId;
1293 fDescriptor.fFieldDescriptors.at(
fieldId).fLinkIds.push_back(
linkId);
1304 return R__FAIL(
"projected field with id '" + std::to_string(
targetId) +
"' doesn't exist in NTuple");
1306 if (
targetId == fDescriptor.GetFieldZeroId()) {
1307 return R__FAIL(
"cannot make FieldZero a projected field");
1310 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of itself");
1312 if (fDescriptor.fFieldDescriptors.at(
sourceId).IsProjectedField()) {
1313 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of an already projected field");
1318 return R__FAIL(
"field '" + std::to_string(
targetId) +
"' has already a projection source ('" +
1319 std::to_string(
targetDesc.GetProjectionSourceId()) +
")");
1338 if (
columnDesc.GetType() != fDescriptor.GetColumnDescriptor(
columnDesc.GetPhysicalId()).GetType())
1339 return R__FAIL(
"alias column type mismatch");
1342 return R__FAIL(
"column index clash");
1346 return R__FAIL(
"out of bounds column index");
1350 return R__FAIL(
"out of bounds representation index");
1356 return R__FAIL(
"incomplete column representations");
1360 return R__FAIL(
"irregular column representations");
1371 fDescriptor.fNPhysicalColumns++;
1372 if (fDescriptor.fHeaderExtension)
1373 fDescriptor.fHeaderExtension->MarkExtendedColumn(
columnDesc);
1382 if (fDescriptor.fClusterGroupDescriptors.count(
id) > 0)
1383 return R__FAIL(
"cluster group id clash");
1386 fDescriptor.fClusterGroupDescriptors.emplace(
id, std::move(
clusterGroup));
1398 if (!fDescriptor.fHeaderExtension)
1399 fDescriptor.fHeaderExtension = std::make_unique<RNTupleDescriptor::RHeaderExtension>();
1404 if (fDescriptor.GetNLogicalColumns() == 0)
1406 R__ASSERT(fDescriptor.GetNPhysicalColumns() > 0);
1408 for (
ROOT::DescriptorId_t id = fDescriptor.GetNLogicalColumns() - 1;
id >= fDescriptor.GetNPhysicalColumns(); --
id) {
1409 auto c = fDescriptor.fColumnDescriptors[
id].Clone();
1412 fDescriptor.fColumnDescriptors.erase(
id);
1413 for (
auto &
link : fDescriptor.fFieldDescriptors[
c.fFieldId].fLogicalColumnIds) {
1414 if (
link ==
c.fLogicalColumnId) {
1420 R__ASSERT(fDescriptor.fColumnDescriptors.count(
c.fLogicalColumnId) == 0);
1421 fDescriptor.fColumnDescriptors.emplace(
c.fLogicalColumnId, std::move(
c));
1425 if (
auto &
xHeader = fDescriptor.fHeaderExtension) {
1427 if (
columnId >= fDescriptor.GetNPhysicalColumns())
1436 if (fDescriptor.fClusterDescriptors.count(
clusterId) > 0)
1437 return R__FAIL(
"cluster id clash");
1446 if (std::find(fDescriptor.fExtraTypeInfoDescriptors.begin(), fDescriptor.fExtraTypeInfoDescriptors.end(),
1448 return R__FAIL(
"extra type info duplicates");
1450 fDescriptor.fExtraTypeInfoDescriptors.emplace_back(std::move(
extraTypeInfoDesc));
1456 auto it = std::find(fDescriptor.fExtraTypeInfoDescriptors.begin(), fDescriptor.fExtraTypeInfoDescriptors.end(),
1458 if (it != fDescriptor.fExtraTypeInfoDescriptors.end())
1461 fDescriptor.fExtraTypeInfoDescriptors.emplace_back(std::move(
extraTypeInfoDesc));
1467 auto &
attrSets = fDescriptor.fAttributeSets;
1469 return desc.GetName() == name;
1471 return R__FAIL(
"attribute sets with duplicate names");
1563 return fAnchorLength ==
other.fAnchorLength && fSchemaVersionMajor ==
other.fSchemaVersionMajor &&
1564 fSchemaVersionMinor ==
other.fSchemaVersionMinor && fAnchorLocator ==
other.fAnchorLocator &&
1571 desc.fAnchorLength = fAnchorLength;
1572 desc.fSchemaVersionMajor = fSchemaVersionMajor;
1573 desc.fSchemaVersionMinor = fSchemaVersionMinor;
1574 desc.fAnchorLocator = fAnchorLocator;
1583 if (
fieldDesc.GetTypeName().rfind(
"std::", 0) == 0)
1590 static const std::string
gIntTypeNames[] = {
"bool",
"char",
"std::int8_t",
"std::uint8_t",
1591 "std::int16_t",
"std::uint16_t",
"std::int32_t",
"std::uint32_t",
1592 "std::int64_t",
"std::uint64_t"};
1601 return (
fieldDesc.GetTypeName().rfind(
"std::atomic<", 0) == 0);
#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
RResult< ROOT::Experimental::RNTupleAttrSetDescriptor > MoveDescriptor()
Attempt to make an AttributeSet descriptor.
Used to loop over all the Attribute Sets linked to an RNTuple.
Metadata stored for every Attribute Set linked to an RNTuple.
bool operator==(const RNTupleAttrSetDescriptor &other) const
RNTupleAttrSetDescriptor Clone() const
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 > MoveDescriptor()
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 > MoveDescriptor()
Attempt to make a field descriptor.
static RFieldDescriptor CloneDescriptor(const RFieldDescriptor &source, RStringPool &stringPool)
void SetNTuple(std::string_view name, 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)
void AddField(RFieldDescriptor fieldDesc)
RResult< void > AddAttributeSet(Experimental::RNTupleAttrSetDescriptor &&attrSetDesc)
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)
RResult< void > AddClusterGroup(RClusterGroupDescriptor &&clusterGroup)
RResult< void > EnsureFieldExists(ROOT::DescriptorId_t fieldId) const
void SetFeature(unsigned int flag)
Sets the flag-th bit of the feature flag to 1.
Used for string interning of repeated type names, field names, etc.
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.
std::unique_ptr< RValueRange > fValueRange
Optional value range (used e.g. by quantized real fields)
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.
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.
@ kTraitSoACollection
The field represents a collection in SoA layout.
@ 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.
RFieldDescriptor Clone() const
Get a copy of the descriptor.
static const std::string & GetEmptyString()
bool operator==(const RFieldDescriptor &other) const
void InitFrom(const RFieldDescriptor &source, Internal::RStringPool &stringPool)
std::unique_ptr< Internal::RStringPool > fStringPool
Optional string storage for a free-standing field descriptor.
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.
Loop over all the clusters of an RNTuple, ordered by first entry number.
Used to loop over all the cluster groups of an RNTuple in order of entry ranges.
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.
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.
std::vector< Experimental::RNTupleAttrSetDescriptor > fAttributeSets
List of AttributeSets linked to this RNTuple.
ROOT::DescriptorId_t fFieldZeroId
Set by the descriptor builder.
std::uint64_t fNEntries
Updated by the descriptor builder when the cluster groups are added.
RClusterDescriptorIterable GetActiveClusterIterable() const
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
ROOT::NTupleSize_t R__DEPRECATED(6, 46, "This function is ill-conceived in the descriptor " "as not all cluster descriptors may be present. This interface is no longer publicly exposed.") GetNElements(ROOT ROOT::DescriptorId_t GetFieldZeroId() const
Returns the logical parent of all top-level RNTuple data fields.
std::vector< std::uint64_t > GetFeatureFlags() const
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.
ROOT::DescriptorId_t FindPhysicalColumnId(ROOT::DescriptorId_t fieldId, std::uint32_t columnIndex, std::uint16_t representationIndex) const
RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const
std::shared_ptr< Internal::RStringPool > fStringPool
Storage for all the field strings. Shared among descriptor clones.
std::uint64_t fNClusters
Updated by the descriptor builder when the cluster groups are added.
RNTupleDescriptor CloneSchema(bool shareStringPool) const
Creates a descriptor containing only the schema information about this RNTuple, i....
std::uint64_t fOnDiskHeaderXxHash3
Set by the descriptor builder when deserialized.
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
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.
ROOT::Experimental::RNTupleAttrSetDescriptorIterable GetAttrSetIterable() const
RFieldDescriptorIterable GetTopLevelFields() const
std::uint16_t fVersionEpoch
Set by the descriptor builder when deserialized.
std::vector< RExtraTypeInfoDescriptor > fExtraTypeInfoDescriptors
RNTupleDescriptor Clone() const
ROOT::DescriptorId_t R__DEPRECATED(6, 46, "This function is ill-defined in the descriptor " "as not all cluster descriptors may be present. This interface is no longer exposed.") FindClusterId(ROOT ROOT::DescriptorId_t R__DEPRECATED(6, 46, "This function is ill-defined in the descriptor " "as not all cluster descriptors may be present. This interface is no longer exposed.") FindNextClusterId(ROOT ROOT::DescriptorId_t R__DEPRECATED(6, 46, "This function is ill-defined in the descriptor " "as not all cluster descriptors may be present. This interface is no longer exposed.") FindPrevClusterId(ROOT 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 ...
bool FieldTypeNamesMayNeedFixup() const
ROOT v6.34, with spec versions before 1.0.0.1, did not properly renormalize the type name.
std::uint64_t fGeneration
The generation of the descriptor.
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)
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)
bool IsCustomEnumFieldDesc(const RNTupleDescriptor &desc, const RFieldDescriptor &fieldDesc)
Tells if the field describes a user-defined enum type.
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.
bool IsStdAtomicFieldDesc(const RFieldDescriptor &fieldDesc)
Tells if the field describes a std::atomic<T> type.
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)