If ImplicitMT
is enabled, Snapshot
cannot update a TTree
at all unless the new dataframe contains the same branch names and types as the old one, in addition to any new ones. In addition, if the data frame does include the same names and types, it appends to the TTree
instead of overwriting it. None of these are the case if multithreading is not enabled. Reproducer follows.
In [1]: import ROOT
In [4]: ROOT.ROOT.EnableImplicitMT()
In [5]: df = ROOT.RDataFrame(10).Define('e', 'rdfentry_')
In [6]: df.Snapshot('t', 'test.root')
Out[6]: <ROOT.ROOT::RDF::RResultPtr<ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void> > object at 0x7fecfa110150>
In [7]: snapopts = ROOT.RDF.RSnapshotOptions()
In [8]: snapopts.fMode = 'UPDATE'
Now, if I try to update t
with a data frame with different column names:
In [10]: df2 = ROOT.RDataFrame(10).Define('two', '2')
In [11]: df2.Snapshot('t', 'test.root', '', snapopts)
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Warning in <TTree::CopyEntries>: One of the export top level branches (e) is not present in the import TTree.
Out[11]: <ROOT.ROOT::RDF::RResultPtr<ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void> > object at 0x7fecfc5bc4c0>
If I try to update t
with the same columns but different types:
In [10]: df3 = ROOT.RDataFrame(10).Define('e', '1000')
In [11]: df3.Snapshot('t', 'test.root', '', snapopts)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Warning in <TTree::CopyEntries>: The export leaf and the import leaf (e.e) do not have the data type (Int_t vs ULong64_t)
Out[11]: <ROOT.ROOT::RDF::RResultPtr<ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void> > object at 0x61d2d80>
If I only add columns, no warnings are raised, but I end up with additional entries instead of overwritten ones:
In [11]: df4 = df.Define('two', '2')
In [12]: snap = df4.Snapshot('t', 'test.root', '', snapopts)
In [13]: snap.Count().GetValue() # should equal 10
Out[13]: 20L
All of the above work without problems if multithreading is not enabled.
ROOT Version: master
Platform: macOS
Compiler: Not Provided