Dear ROOT,
Using the RDataFrame in Python, I am getting curious results when using an RVec object. I tried this on the ROOT prompt, and the same issue is shown there. The C++ version:
ROOT::RDataFrame rdf(100);
auto rdf_x = rdf.Define("x", [](){ return gRandom->Rndm(); }).Define("test","ROOT::RVec<bool> out; out.push_back(true); return out;");
auto disp = rdf_x.Display({"x","test"},20);
disp->Print();
This simple code shows the issue. At each next event an additional true
is added to the test column, instead of just one.
+-----+------------+------+
| Row | x | test |
+-----+------------+------+
| 0 | 0.99974175 | true |
+-----+------------+------+
| 1 | 0.16290988 | true |
| | | true |
+-----+------------+------+
| 2 | 0.28261781 | true |
| | | true |
| | | true |
+-----+------------+------+
| 3 | 0.94720108 | true |
| | | true |
| | | true |
| | | true |
+-----+------------+------+
| 4 | 0.23165654 | true |
| | | true |
| | | true |
| | | true |
| | | true |
+-----+------------+------+
| 5 | 0.48497361 | true |
| | | true |
| | | true |
| | | true |
| | | true |
| | | true |
+-----+------------+------+
If I replace the RVec<bool>
with an RVec<int>
there is no problem, I get only one 1
in the column. The same if I replace RVec<bool>
with std::vector<int>
. However, if I replace the RVec<bool>
with std::vector<bool>
, the root system crashes completely, with the error:
/Users/maurik/root/master/include/ROOT/RDF/RDisplay.hxx:132:57: error: no viable conversion from '__bit_iterator<std::vector<bool, std::allocator<bool> >, false>' to 'const void *'
<< ROOT::Internal::RDF::PrettyPrintAddr(&(collection[i])) << ");";
The work-around is easy, just use RVec<int>
and avoid bool
altogether, but for compiled libraries that work with bool types and using the PyROOT interface which converts vectors to RVec object, this seems to not be quite as easy.
Am I doing something I am not supposed to do?
Is there a fix or better solution?
Thanks,
Maurik
ROOT Version: Git master: 6.29/01
Platform: MacOS M1
Compiler: clang 13.0.0