RDataFrame Snapshot of RVec<std::string>

Dear experts,
My question seems to be related to this issue
I tried to save my dataframe with a Snapshot of column type ROOT::RVec<std::string> because I though that the RVec is preferred over std::vector - I am not able to save the tree correctly (I don’t generate the dictionary)

Error in <TTree::Branch>: The class requested (vector<string,ROOT::Detail::VecOps::RAdoptAllocator<string> >) for the branch "aaa" is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (vector<string,ROOT::Detail::VecOps::RAdoptAllocator<string> >) to avoid to write corrupted data.

if I change the code to std::vector<std::string> the tree gets saved.

According to the linked thread, ROOT is doing some on the fly conversion from RVec to std::vector - is it supposed to work on std::string or do I always need the dictionary in this case?


ROOT Version: 6.22/00
Platform: CentOS7/MacOS
Compiler: g++

Maybe @eguiraud can give some hints

I’m attaching an example - in my case, I create the RVec<string> or vector<string> on the fly, it is not read from disk
rdf_rvecstring.C (418 Bytes)

Hi @zhubacek ,
Snapshot performs an on-the-fly conversion to std::vector but due to some subtleties, for types other than fundamental types, you still need dictionaries that you wouldn’t need if you just used std::vectors.
We are making things better for 6.26: there RVec will behave the same as std::vector in terms of I/O, and if it doesn’t it’s a bug to fix/improvement to add.

The simplest solution for 6.24 (the current stable release) and previous releases is to use vector<std::string>.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.