Skip to content

Commit 8a09b36

Browse files
committed
[df] Fix warning about untriggered lazy RNTuple snapshot
Use the same conditions as TTree, looking at fOutputFile instead of the data source.
1 parent 6548e1e commit 8a09b36

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

tree/dataframe/src/RDFSnapshotHelpers.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper &ROOT::Internal::RDF::UntypedS
829829

830830
ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::~UntypedSnapshotRNTupleHelper()
831831
{
832-
if (!fNTupleName.empty() && !fOutputLoopManager->GetDataSource() && fOptions.fLazy)
832+
if (!fNTupleName.empty() /* not moved from */ && !fOutputFile /* did not run */ && fOptions.fLazy)
833833
Warning("Snapshot", "A lazy Snapshot action was booked but never triggered.");
834834
}
835835

tree/dataframe/test/dataframe_snapshot_ntuple.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ TEST(RDFSnapshotRNTuple, FromScratch)
7272
}
7373
}
7474

75+
TEST(RDFSnapshotRNTuple, LazyTriggered)
76+
{
77+
FileRAII fileGuard{"RDFSnapshotRNTuple_lazy.root"};
78+
auto d = ROOT::RDataFrame(1);
79+
ROOT::RDF::RSnapshotOptions opts;
80+
opts.fOutputFormat = ROOT::RDF::ESnapshotOutputFormat::kRNTuple;
81+
opts.fLazy = true;
82+
auto r = d.Snapshot("t", fileGuard.GetPath(), {"rdfentry_"}, opts);
83+
*r;
84+
r = {};
85+
}
86+
7587
void BookLazySnapshot(std::string_view filename)
7688
{
7789
auto d = ROOT::RDataFrame(1);

0 commit comments

Comments
 (0)