Skip to content

Commit f801abd

Browse files
committed
[ntuple] Add GetNEntries() to RPageSink
This is needed by the RNTupleMerger to properly know the initial number of entries in the destination sink in case of incremental merging. Since the Descriptor's NEntries is not updated until the first cluster group is committed - and since we don't commit a cluster group in InitFromDescriptor() - it cannot be used for that purpose.
1 parent c30163e commit f801abd

File tree

6 files changed

+14
-0
lines changed

6 files changed

+14
-0
lines changed

tree/ntuple/v7/inc/ROOT/RPageNullSink.hxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public:
4848
return descriptor;
4949
}
5050

51+
NTupleSize_t GetNEntries() const final { return 0; }
52+
5153
void ConnectFields(const std::vector<RFieldBase *> &fields, NTupleSize_t firstEntry)
5254
{
5355
auto connectField = [&](RFieldBase &f) { CallConnectPageSinkOnField(f, *this, firstEntry); };

tree/ntuple/v7/inc/ROOT/RPageSinkBuf.hxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ public:
133133

134134
const RNTupleDescriptor &GetDescriptor() const final;
135135

136+
NTupleSize_t GetNEntries() const final { return fInnerSink->GetNEntries(); }
137+
136138
void InitImpl(RNTupleModel &model) final;
137139
void UpdateSchema(const RNTupleModelChangeset &changeset, NTupleSize_t firstEntry) final;
138140
void UpdateExtraTypeInfo(const RExtraTypeInfoDescriptor &extraTypeInfo) final;

tree/ntuple/v7/inc/ROOT/RPageStorage.hxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ public:
317317
/// Return the RNTupleDescriptor being constructed.
318318
virtual const RNTupleDescriptor &GetDescriptor() const = 0;
319319

320+
virtual NTupleSize_t GetNEntries() const = 0;
321+
320322
/// Physically creates the storage container to hold the ntuple (e.g., a keys a TFile or an S3 bucket)
321323
/// Init() associates column handles to the columns referenced by the model
322324
void Init(RNTupleModel &model)
@@ -519,6 +521,8 @@ public:
519521

520522
const RNTupleDescriptor &GetDescriptor() const final { return fDescriptorBuilder.GetDescriptor(); }
521523

524+
NTupleSize_t GetNEntries() const final { return fPrevClusterNEntries; }
525+
522526
/// Updates the descriptor and calls InitImpl() that handles the backend-specific details (file, DAOS, etc.)
523527
void InitImpl(RNTupleModel &model) final;
524528
void UpdateSchema(const RNTupleModelChangeset &changeset, NTupleSize_t firstEntry) final;

tree/ntuple/v7/src/RNTupleParallelWriter.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class RPageSynchronizingSink : public RPageSink {
7474

7575
const RNTupleDescriptor &GetDescriptor() const final { return fInnerSink->GetDescriptor(); }
7676

77+
NTupleSize_t GetNEntries() const final { return fInnerSink->GetNEntries(); }
78+
7779
ColumnHandle_t AddColumn(DescriptorId_t, RColumn &) final { return {}; }
7880
void InitImpl(RNTupleModel &) final {}
7981
void UpdateSchema(const RNTupleModelChangeset &, NTupleSize_t) final

tree/ntuple/v7/test/ntuple_endian.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class RPageSinkMock : public RPageSink {
4949
return descriptor;
5050
}
5151

52+
NTupleSize_t GetNEntries() const final { return 0; }
53+
5254
void InitImpl(RNTupleModel &) final {}
5355
void UpdateSchema(const ROOT::Experimental::Internal::RNTupleModelChangeset &, NTupleSize_t) final {}
5456
void UpdateExtraTypeInfo(const ROOT::Experimental::RExtraTypeInfoDescriptor &) final {}

tree/ntuple/v7/test/ntuple_storage.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class RPageSinkMock : public RPageSink {
4141
return descriptor;
4242
}
4343

44+
NTupleSize_t GetNEntries() const final { return 0; }
45+
4446
void InitImpl(RNTupleModel &) final {}
4547
void UpdateSchema(const ROOT::Experimental::Internal::RNTupleModelChangeset &, NTupleSize_t) final {}
4648
void UpdateExtraTypeInfo(const ROOT::Experimental::RExtraTypeInfoDescriptor &) final {}

0 commit comments

Comments
 (0)