Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tree/dataframe/src/RDFSnapshotHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ void EnsureValidSnapshotRNTupleOutput(const ROOT::RDF::RSnapshotOptions &opts, c
if (!outFile || outFile->IsZombie())
throw std::invalid_argument("Snapshot: cannot open file \"" + fileName + "\" in update mode");

auto *outNTuple = outFile->Get<ROOT::RNTuple>(ntupleName.c_str());
std::unique_ptr<ROOT::RNTuple> uoNT { outFile->Get<ROOT::RNTuple>(ntupleName.c_str()) };
Comment thread
ferdymercury marked this conversation as resolved.
Outdated
auto *outNTuple = uoNT.get();

if (outNTuple) {
if (opts.fOverwriteIfExists) {
Expand Down Expand Up @@ -937,6 +938,8 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Initialize()
writeOptions.SetEnablePageChecksums(fOptions.fEnablePageChecksums);
writeOptions.SetEnableSamePageMerging(fOptions.fEnableSamePageMerging);

// Delete beforehand (.reset does it in inverse order, creates new and then deletes)
delete fOutputFile.release();
fOutputFile.reset(TFile::Open(fFileName.c_str(), fOptions.fMode.c_str()));
if (!fOutputFile)
throw std::runtime_error("Snapshot: could not create output file " + fFileName);
Expand Down
Loading