@@ -85,20 +85,48 @@ std::vector<std::string> getListOfTables(std::unique_ptr<TFile>& f)
8585{
8686 std::vector<std::string> r;
8787 TList* keyList = f->GetListOfKeys ();
88+ // We should handle two cases, one where the list of tables in a TDirectory,
89+ // the other one where the dataframe number is just a prefix
90+ std::string first = " " ;
8891
8992 for (auto key : *keyList) {
90- if (!std::string_view (key->GetName ()).starts_with (" DF_" )) {
93+ if (!std::string_view (key->GetName ()).starts_with (" DF_" ) && ! std::string_view (key-> GetName ()). starts_with ( " /DF_ " ) ) {
9194 continue ;
9295 }
93- auto * d = (TDirectory*)f->Get (key->GetName ());
94- TList* branchList = d->GetListOfKeys ();
95- for (auto b : *branchList) {
96- r.emplace_back (b->GetName ());
96+ auto * d = (TDirectory*)f->GetObjectChecked (key->GetName (), TClass::GetClass (" TDirectory" ));
97+ // Objects are in a folder, list it.
98+ if (d) {
99+ TList* branchList = d->GetListOfKeys ();
100+ for (auto b : *branchList) {
101+ r.emplace_back (b->GetName ());
102+ }
103+ break ;
104+ }
105+
106+ void * v = f->GetObjectChecked (key->GetName (), TClass::GetClass (" ROOT::Experimental::RNTuple" ));
107+ if (v) {
108+ std::string s = key->GetName ();
109+ size_t pos = s.find (' -' );
110+ // Check if '-' is found
111+ // Skip metaData and parentFiles
112+ if (pos == std::string::npos) {
113+ continue ;
114+ }
115+ std::string t = s.substr (pos + 1 );
116+ // If we find a duplicate table name, it means we are in the next DF and we can stop.
117+ if (t == first) {
118+ break ;
119+ }
120+ if (first.empty ()) {
121+ first = t;
122+ }
123+ // Create a new string starting after the '-'
124+ r.emplace_back (t);
97125 }
98- break ;
99126 }
100127 return r;
101128}
129+
102130auto readMetadata (std::unique_ptr<TFile>& currentFile) -> std::vector<ConfigParamSpec>
103131{
104132 // Get the metadata, if any
0 commit comments