From dc074dbafae13e08343a9d3cc1db1979e24c2877 Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Thu, 9 Jul 2026 10:42:47 +0200 Subject: [PATCH 1/2] [df] Ensure proper writing of TFile in finalisation of RNTuple Snapshot --- tree/dataframe/src/RDFSnapshotHelpers.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tree/dataframe/src/RDFSnapshotHelpers.cxx b/tree/dataframe/src/RDFSnapshotHelpers.cxx index 3764a447627ca..e69099224e122 100644 --- a/tree/dataframe/src/RDFSnapshotHelpers.cxx +++ b/tree/dataframe/src/RDFSnapshotHelpers.cxx @@ -971,6 +971,8 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Finalize() fFillContexts.clear(); // Then destroy the RNTupleParallelWriter and write the metadata. fWriter.reset(); + // Finally, destroy the output TFile to ensure it's properly written to disk. + fOutputFile.reset(); // We can now set the data source of the loop manager for the RDataFrame that is returned by the Snapshot call. fOutputLoopManager->SetDataSource(std::make_unique(fDirName + "/" + fNTupleName, fFileName)); } From cd7d974f795f3c15efc6e058b0602896032db044 Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Thu, 9 Jul 2026 10:44:03 +0200 Subject: [PATCH 2/2] [df] Use correct RNTuple name for top-level object Aligning the implementation with the TTree Snapshot helper. --- tree/dataframe/src/RDFSnapshotHelpers.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tree/dataframe/src/RDFSnapshotHelpers.cxx b/tree/dataframe/src/RDFSnapshotHelpers.cxx index e69099224e122..0b517b735fac2 100644 --- a/tree/dataframe/src/RDFSnapshotHelpers.cxx +++ b/tree/dataframe/src/RDFSnapshotHelpers.cxx @@ -971,10 +971,13 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Finalize() fFillContexts.clear(); // Then destroy the RNTupleParallelWriter and write the metadata. fWriter.reset(); - // Finally, destroy the output TFile to ensure it's properly written to disk. - fOutputFile.reset(); + // Finally, close the output TFile to ensure it's properly written to disk. We don't destroy it to avoid triggering + // a warning about the lazy Snapshot not being triggered + fOutputFile->Close(); + // We can now set the data source of the loop manager for the RDataFrame that is returned by the Snapshot call. - fOutputLoopManager->SetDataSource(std::make_unique(fDirName + "/" + fNTupleName, fFileName)); + const auto fullNTupleName = fDirName.empty() ? fNTupleName : fDirName + '/' + fNTupleName; + fOutputLoopManager->SetDataSource(std::make_unique(fullNTupleName, fFileName)); } /**