Skip to content

Commit 123d381

Browse files
committed
[ntuple] add RPagePersistentSink::AddAliasColumn
1 parent 528407d commit 123d381

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

tree/ntuple/inc/ROOT/RPageStorage.hxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ public:
547547
void
548548
AddColumnRepresentation(const ROOT::RFieldDescriptor &field, std::span<const ENTupleColumnType> newRepresentation);
549549

550+
/// Adds a new alias column pointing to an existing column with the given physical id to the given field.
551+
void AddAliasColumn(const ROOT::RNTupleDescriptor &desc, const ROOT::RFieldDescriptor &field,
552+
ROOT::DescriptorId_t physicalId);
553+
550554
void CommitSuppressedColumn(ColumnHandle_t columnHandle) final;
551555
void CommitPage(ColumnHandle_t columnHandle, const ROOT::Internal::RPage &page) final;
552556
void CommitSealedPage(ROOT::DescriptorId_t physicalColumnId, const RPageStorage::RSealedPage &sealedPage) final;

tree/ntuple/src/RPageStorage.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,27 @@ void ROOT::Internal::RPagePersistentSink::AddColumnRepresentation(const ROOT::RF
11141114
}
11151115
}
11161116

1117+
void ROOT::Internal::RPagePersistentSink::AddAliasColumn(const ROOT::RNTupleDescriptor &desc,
1118+
const ROOT::RFieldDescriptor &field,
1119+
ROOT::DescriptorId_t physicalId)
1120+
{
1121+
const auto &pointedColumn = desc.GetColumnDescriptor(physicalId);
1122+
assert(!pointedColumn.IsAliasColumn());
1123+
1124+
const auto columnId = fDescriptorBuilder.GetDescriptor().GetNLogicalColumns();
1125+
RColumnDescriptorBuilder columnBuilder;
1126+
columnBuilder.LogicalColumnId(columnId)
1127+
.PhysicalColumnId(physicalId)
1128+
.FieldId(field.GetId())
1129+
.Type(pointedColumn.GetType())
1130+
.Index(pointedColumn.GetIndex())
1131+
.BitsOnStorage(pointedColumn.GetBitsOnStorage())
1132+
.ValueRange(pointedColumn.GetValueRange())
1133+
.FirstElementIndex(pointedColumn.GetFirstElementIndex())
1134+
.RepresentationIndex(pointedColumn.GetRepresentationIndex());
1135+
fDescriptorBuilder.AddColumn(columnBuilder.MakeDescriptor().Unwrap());
1136+
}
1137+
11171138
void ROOT::Internal::RPagePersistentSink::CommitSuppressedColumn(ColumnHandle_t columnHandle)
11181139
{
11191140
fOpenColumnRanges.at(columnHandle.fPhysicalId).SetIsSuppressed(true);

0 commit comments

Comments
 (0)