Skip to content

Commit 6ed447c

Browse files
committed
[ntuple] Use actual unaligned ntuples in join test
We previously only pretended the join was unaligned by providing a join key. To further strengthen the test, now a join between two actual unaligned ntuples is used.
1 parent 0cf5956 commit 6ed447c

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

tree/ntuple/v7/test/ntuple_processor.cxx

+23-7
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ TEST(RNTupleProcessor, EmptyNTuple)
2424

2525
class RNTupleProcessorTest : public testing::Test {
2626
protected:
27-
const std::array<std::string, 2> fFileNames{"test_ntuple_processor1.root", "test_ntuple_processor2.root"};
28-
const std::array<std::string, 2> fNTupleNames{"ntuple", "ntuple_aux"};
27+
const std::array<std::string, 3> fFileNames{"test_ntuple_processor1.root", "test_ntuple_processor2.root",
28+
"test_ntuple_processor3.root"};
29+
const std::array<std::string, 3> fNTupleNames{"ntuple", "ntuple_aux", "ntuple_aux"};
2930

3031
void SetUp() override
3132
{
@@ -55,6 +56,19 @@ class RNTupleProcessorTest : public testing::Test {
5556
ntuple->Fill();
5657
}
5758
}
59+
// Same as above, but entries in reverse order
60+
{
61+
auto model = RNTupleModel::Create();
62+
auto fldI = model->MakeField<int>("i");
63+
auto fldZ = model->MakeField<float>("z");
64+
auto ntuple = RNTupleWriter::Recreate(std::move(model), fNTupleNames[2], fFileNames[2]);
65+
66+
for (int i = 4; i >= 0; --i) {
67+
*fldI = i;
68+
*fldZ = i * 2.f;
69+
ntuple->Fill();
70+
}
71+
}
5872
}
5973
};
6074

@@ -165,12 +179,14 @@ TEST_F(RNTupleProcessorTest, ChainedChain)
165179

166180
TEST_F(RNTupleProcessorTest, ChainedJoin)
167181
{
168-
std::vector<RNTupleOpenSpec> ntuples{{fNTupleNames[0], fFileNames[0]}, {fNTupleNames[1], fFileNames[1]}};
169-
170182
std::vector<std::unique_ptr<RNTupleProcessor>> innerProcs;
171-
innerProcs.push_back(RNTupleProcessor::CreateJoin(ntuples, {}));
172-
innerProcs.push_back(RNTupleProcessor::CreateJoin(ntuples, {"i"}));
173-
183+
// The ntuples are aligned
184+
innerProcs.push_back(
185+
RNTupleProcessor::CreateJoin({{fNTupleNames[0], fFileNames[0]}, {fNTupleNames[1], fFileNames[1]}}, {}));
186+
// The ntuples are unaligned, so we join on "i"
187+
innerProcs.push_back(
188+
RNTupleProcessor::CreateJoin({{fNTupleNames[0], fFileNames[0]}, {fNTupleNames[2], fFileNames[2]}}, {"i"}));
189+
// The chain processor shouldn't care about the fact that the first join is aligned, but the second one isn't
174190
auto proc = RNTupleProcessor::CreateChain(std::move(innerProcs));
175191

176192
int nEntries = 0;

0 commit comments

Comments
 (0)