Skip to content

Commit 8ced87e

Browse files
committed
[ntuple] Rename RNTupleComposer data members and functions
...to reflect the separation between `RNTupleProcessor` and `RNTupleComposer`.
1 parent 1ce71e9 commit 8ced87e

6 files changed

Lines changed: 294 additions & 289 deletions

File tree

tree/ntuple/inc/ROOT/RNTupleComposer.hxx

Lines changed: 169 additions & 168 deletions
Large diffs are not rendered by default.

tree/ntuple/src/RNTupleComposer.cxx

Lines changed: 102 additions & 99 deletions
Large diffs are not rendered by default.

tree/ntuple/test/ntuple_composer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ TEST_F(RNTupleComposerTest, Base)
181181
} catch (const ROOT::RException &err) {
182182
EXPECT_THAT(err.what(),
183183
testing::HasSubstr("cannot register field with name \"z\" because it is not present in the on-disk "
184-
"information of the RNTuple(s) this processor is created from"));
184+
"information of the RNTuple(s) this composition is created from"));
185185
}
186186

187187
auto processor = RNTupleProcessor(*composer);

tree/ntuple/test/ntuple_composer_chain.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ TEST_F(RNTupleChainComposerTest, Basic)
9999
{
100100
auto composer = RNTupleComposer::CreateChain({{fNTupleName, fFileNames[0]}, {fNTupleName, fFileNames[1]}});
101101

102-
EXPECT_STREQ("ntuple", composer->GetProcessorName().c_str());
102+
EXPECT_STREQ("ntuple", composer->GetCompositionName().c_str());
103103

104104
{
105105
auto namedProc =
106106
RNTupleComposer::CreateChain({{fNTupleName, fFileNames[0]}, {fNTupleName, fFileNames[1]}}, "my_ntuple");
107-
EXPECT_STREQ("my_ntuple", namedProc->GetProcessorName().c_str());
107+
EXPECT_STREQ("my_ntuple", namedProc->GetCompositionName().c_str());
108108
}
109109

110110
auto x = composer->RequestField<float>("x");
@@ -198,19 +198,19 @@ TEST_F(RNTupleChainComposerTest, LoadRandomEntry)
198198

199199
RNTupleComposerEntryLoader::LoadEntry(*composer, 3);
200200
EXPECT_EQ(3.f, *x);
201-
EXPECT_EQ(0, composer->GetCurrentProcessorNumber());
201+
EXPECT_EQ(0, composer->GetCurrentChainIndex());
202202

203203
RNTupleComposerEntryLoader::LoadEntry(*composer, 9);
204204
EXPECT_EQ(9.f, *x);
205-
EXPECT_EQ(1, composer->GetCurrentProcessorNumber());
205+
EXPECT_EQ(1, composer->GetCurrentChainIndex());
206206

207207
RNTupleComposerEntryLoader::LoadEntry(*composer, 6);
208208
EXPECT_EQ(6.f, *x);
209-
EXPECT_EQ(1, composer->GetCurrentProcessorNumber());
209+
EXPECT_EQ(1, composer->GetCurrentChainIndex());
210210

211211
RNTupleComposerEntryLoader::LoadEntry(*composer, 2);
212212
EXPECT_EQ(2.f, *x);
213-
EXPECT_EQ(0, composer->GetCurrentProcessorNumber());
213+
EXPECT_EQ(0, composer->GetCurrentChainIndex());
214214

215215
EXPECT_EQ(ROOT::kInvalidNTupleIndex, RNTupleComposerEntryLoader::LoadEntry(*composer, 10));
216216
}

tree/ntuple/test/ntuple_composer_join.cxx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,38 +197,39 @@ TEST_F(RNTupleJoinComposerTest, UnalignedMultipleJoinFields)
197197
try {
198198
RNTupleComposer::CreateJoin({fNTupleNames[0], fFileNames[0]}, {fNTupleNames[3], fFileNames[3]},
199199
{"i", "j", "k", "l", "m"});
200-
FAIL() << "trying to create a join processor with more than four join fields should throw";
200+
FAIL() << "trying to create an RNTupleJoinComposer with more than four join fields should throw";
201201
} catch (const ROOT::RException &err) {
202202
EXPECT_THAT(err.what(), testing::HasSubstr("a maximum of four join fields is allowed"));
203203
}
204204

205205
try {
206206
RNTupleComposer::CreateJoin({fNTupleNames[0], fFileNames[0]}, {fNTupleNames[3], fFileNames[3]}, {"i", "i"});
207-
FAIL() << "trying to create a join processor with duplicate join fields should throw";
207+
FAIL() << "trying to create an RNTupleJoinComposer with duplicate join fields should throw";
208208
} catch (const ROOT::RException &err) {
209209
EXPECT_THAT(err.what(), testing::HasSubstr("join fields must be unique"));
210210
}
211211

212212
try {
213213
auto composer =
214214
RNTupleComposer::CreateJoin({fNTupleNames[0], fFileNames[0]}, {fNTupleNames[1], fFileNames[1]}, {"l"});
215-
// Without registering a field, the processor won't be initialized.
215+
// Without registering a field, the compoer won't be initialized.
216216
composer->RequestField<float>("x");
217-
FAIL() << "trying to use a join processor where not all join fields are present in the primary processor should "
218-
"throw";
217+
FAIL() << "trying to use an RNTupleJoinComposer where not all join fields are present in the primary composition "
218+
"should throw";
219219
} catch (const ROOT::RException &err) {
220-
EXPECT_THAT(err.what(), testing::HasSubstr("could not find join field \"l\" in primary processor \"ntuple1\""));
220+
EXPECT_THAT(err.what(), testing::HasSubstr("could not find join field \"l\" in primary composition \"ntuple1\""));
221221
}
222222

223223
try {
224224
auto composer = RNTupleComposer::CreateJoin({fNTupleNames[0], fFileNames[0]}, {fNTupleNames[1], fFileNames[1]},
225225
{"i", "j", "k"});
226-
// Without registering a field, the processor won't be initialized.
226+
// Without registering a field, the composer won't be initialized.
227227
composer->RequestField<float>("x");
228-
FAIL() << "trying to use a join processor where not all join fields are present in the auxiliary processor "
229-
"should throw";
228+
FAIL() << "trying to use an RNTupleJoinComposer where not all join fields are present in the auxiliary "
229+
"composition should throw";
230230
} catch (const ROOT::RException &err) {
231-
EXPECT_THAT(err.what(), testing::HasSubstr("could not find join field \"j\" in auxiliary processor \"ntuple2\""));
231+
EXPECT_THAT(err.what(),
232+
testing::HasSubstr("could not find join field \"j\" in auxiliary composition \"ntuple2\""));
232233
}
233234

234235
auto composer =

tutorials/io/ntuple/ntpl012_processor_chain.C

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void Read(const std::vector<RNTupleOpenSpec> &ntuples)
6868
// The chain-based composition can be created by passing a list of RNTupleOpenSpecs, describing the name and location
6969
// of each RNTuple in the chain.
7070
auto composer = RNTupleComposer::CreateChain(ntuples);
71-
int prevProcessorNumber{-1};
71+
int prevChainIdx{-1};
7272

7373
// Access to the composition's fields is done by first requesting them through RNTupleComposer::RequestField(). The
7474
// returned value can be used to read the current entry's value for that particular field.
@@ -80,10 +80,10 @@ void Read(const std::vector<RNTupleOpenSpec> &ntuples)
8080
// The iterator value is the index of the current entry being processed.
8181
for (auto idx : processor) {
8282
// The RNTupleProcessor provides some additional bookkeeping information, such as the current processor number.
83-
if (static_cast<int>(composer->GetCurrentProcessorNumber()) > prevProcessorNumber) {
84-
prevProcessorNumber = composer->GetCurrentProcessorNumber();
85-
std::cout << "Processing `ntuple" << prevProcessorNumber + 1 << "` (" << idx + 1
86-
<< " total entries processed so far)" << std::endl;
83+
if (static_cast<int>(composer->GetCurrentChainIndex()) > prevChainIdx) {
84+
prevChainIdx = composer->GetCurrentChainIndex();
85+
std::cout << "Processing `ntuple" << prevChainIdx + 1 << "` (" << idx + 1 << " total entries processed so far)"
86+
<< std::endl;
8787
}
8888

8989
// We use the value returned from requesting the field to read its data for the current entry.

0 commit comments

Comments
 (0)