-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[ntuple] properly support incremental merging with Union mode #17563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
09a8ac0
[ntuple] add unit test for incremental merging with LM extension
silverweed 96a5e3b
[ntuple] skip deferred columns when merging
silverweed febd8db
[ntuple] add RNTupleDescriptor::CloneSchema
silverweed 96b37b4
[ntuple] store the destination model in the RNTupleMerger
silverweed 331039c
[ntuple] Merger: use kForWriting when loading the source descriptor
silverweed 827db46
[ntuple] reformat if-else chain in ColumnInMemoryType
silverweed 08bc1f4
[ntuple] fix schema serialization
silverweed 9469b92
[ntuple] add unit tests for serialization of "nonstandard" header
silverweed bbcd1b6
[ntuple] minor cleanups
silverweed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1603,3 +1603,60 @@ TEST(RNTupleMerger, MergeAsymmetric1TFileMerger) | |
} | ||
} | ||
} | ||
|
||
TEST(RNTupleMerger, MergeIncrementalLMExt) | ||
{ | ||
// Create the input files | ||
std::vector<FileRaii> inputFiles; | ||
const auto nInputs = 10; | ||
auto model = RNTupleModel::Create(); | ||
for (int fileIdx = 0; fileIdx < nInputs; ++fileIdx) { | ||
auto &fileGuard = | ||
inputFiles.emplace_back(std::string("test_ntuple_merge_incr_lmext_in_") + std::to_string(fileIdx) + ".root"); | ||
fileGuard.PreserveFile(); | ||
|
||
// Each input gets a different model, so we can exercise the late model extension. | ||
// Just to have some variation, use different types depending on the field index | ||
const auto fieldName = std::string("f_") + std::to_string(fileIdx); | ||
switch (fileIdx % 3) { | ||
case 0: model->MakeField<int>(fieldName); break; | ||
case 1: model->MakeField<float>(fieldName); break; | ||
default: model->MakeField<std::string>(fieldName); | ||
} | ||
|
||
auto writer = RNTupleWriter::Recreate(model->Clone(), "ntpl", fileGuard.GetPath()); | ||
|
||
// Fill the RNTuple with nFills per field | ||
const auto nFills = 5; | ||
const auto &entry = writer->GetModel().GetDefaultEntry(); | ||
for (int fillIdx = 0; fillIdx < nFills; ++fillIdx) { | ||
for (int fieldIdx = 0; fieldIdx < fileIdx + 1; ++fieldIdx) { | ||
const auto fldName = std::string("f_") + std::to_string(fieldIdx); | ||
switch (fieldIdx % 3) { | ||
case 0: *entry.GetPtr<int>(fldName) = fileIdx + fillIdx + fieldIdx; break; | ||
case 1: *entry.GetPtr<float>(fldName) = fileIdx + fillIdx + fieldIdx; break; | ||
default: *entry.GetPtr<std::string>(fldName) = std::to_string(fileIdx + fillIdx + fieldIdx); | ||
} | ||
writer->Fill(); | ||
} | ||
} | ||
} | ||
|
||
// Incrementally merge the inputs | ||
FileRaii fileGuard("test_ntuple_merge_incr_lmext.root"); | ||
fileGuard.PreserveFile(); | ||
const auto compression = 0;//ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. commented? |
||
|
||
TFileMerger merger(kFALSE, kFALSE); | ||
merger.OutputFile(fileGuard.GetPath().c_str(), "RECREATE", compression); | ||
merger.SetMergeOptions(TString("rntuple.MergingMode=Union")); | ||
|
||
for (int i = 0; i < nInputs; ++i) { | ||
auto tfile = std::unique_ptr<TFile>(TFile::Open(inputFiles[i].GetPath().c_str(), "READ")); | ||
|
||
merger.AddFile(tfile.get()); | ||
bool result = | ||
merger.PartialMerge(TFileMerger::kIncremental | TFileMerger::kNonResetable | TFileMerger::kKeepCompression); | ||
ASSERT_TRUE(result); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this test work at that point of the history? We should not have intermittent failing tests, to not break
git-bisect