@@ -358,9 +358,9 @@ TEST(RNTupleInspector, ColumnTypeCount)
358
358
EXPECT_EQ (3 , inspector->GetColumnCountByType (ENTupleColumnType::kSplitInt32 ));
359
359
}
360
360
361
- TEST (RNTupleInspector, ColumnsByType )
361
+ TEST (RNTupleInspector, GetColumnIdsByType )
362
362
{
363
- FileRaii fileGuard (" test_ntuple_inspector_columns_by_type .root" );
363
+ FileRaii fileGuard (" test_ntuple_inspector_column_ids .root" );
364
364
{
365
365
auto model = RNTupleModel::Create ();
366
366
auto nFldInt1 = model->MakeField <std::int64_t >(" int1" );
@@ -374,24 +374,83 @@ TEST(RNTupleInspector, ColumnsByType)
374
374
}
375
375
376
376
auto inspector = RNTupleInspector::Create (" ntuple" , fileGuard.GetPath ());
377
-
378
- EXPECT_EQ (2U , inspector->GetColumnsByType (ENTupleColumnType::kSplitInt64 ).size ());
379
- for (const auto colId : inspector->GetColumnsByType (ENTupleColumnType::kSplitInt64 )) {
377
+ EXPECT_EQ (2U , inspector->GetColumnIds (ENTupleColumnType::kSplitInt64 ).size ());
378
+ for (const auto colId : inspector->GetColumnIds (ENTupleColumnType::kSplitInt64 )) {
380
379
EXPECT_EQ (ENTupleColumnType::kSplitInt64 , inspector->GetColumnInspector (colId).GetType ());
381
380
}
382
381
383
- EXPECT_EQ (2U , inspector->GetColumnsByType (ENTupleColumnType::kSplitReal32 ).size ());
384
- for (const auto colId : inspector->GetColumnsByType (ENTupleColumnType::kSplitReal32 )) {
382
+ EXPECT_EQ (2U , inspector->GetColumnIds (ENTupleColumnType::kSplitReal32 ).size ());
383
+ for (const auto colId : inspector->GetColumnIds (ENTupleColumnType::kSplitReal32 )) {
385
384
EXPECT_EQ (ENTupleColumnType::kSplitReal32 , inspector->GetColumnInspector (colId).GetType ());
386
385
}
387
386
388
- EXPECT_EQ (1U , inspector->GetColumnsByType (ENTupleColumnType::kSplitIndex64 ).size ());
389
- EXPECT_EQ (1U , inspector->GetColumnsByType (ENTupleColumnType::kSplitIndex64 ).size ());
390
- for (const auto colId : inspector->GetColumnsByType (ENTupleColumnType::kSplitIndex64 )) {
387
+ EXPECT_EQ (1U , inspector->GetColumnIds (ENTupleColumnType::kSplitIndex64 ).size ());
388
+ for (const auto colId : inspector->GetColumnIds (ENTupleColumnType::kSplitIndex64 )) {
391
389
EXPECT_EQ (ENTupleColumnType::kSplitIndex64 , inspector->GetColumnInspector (colId).GetType ());
392
390
}
393
391
394
- EXPECT_EQ (0U , inspector->GetColumnsByType (ENTupleColumnType::kSplitReal64 ).size ());
392
+ EXPECT_EQ (0U , inspector->GetColumnIds (ENTupleColumnType::kSplitReal64 ).size ());
393
+ }
394
+
395
+ TEST (RNTupleInspector, GetColumnIdsRecursive)
396
+ {
397
+ FileRaii fileGuard (" test_ntuple_inspector_column_ids_recursive.root" );
398
+ {
399
+ auto model = RNTupleModel::Create ();
400
+ auto nFldInt1 = model->MakeField <std::int64_t >(" int1" );
401
+ auto nFldInt2 = model->MakeField <std::int64_t >(" int2" );
402
+ auto nFldFloat = model->MakeField <float >(" float" );
403
+ auto nFldFloatVec = model->MakeField <std::vector<float >>(" floatVec" );
404
+
405
+ auto writeOptions = RNTupleWriteOptions ();
406
+ writeOptions.SetCompression (505 );
407
+ auto ntuple = RNTupleWriter::Recreate (std::move (model), " ntuple" , fileGuard.GetPath (), writeOptions);
408
+ }
409
+
410
+ auto inspector = RNTupleInspector::Create (" ntuple" , fileGuard.GetPath ());
411
+
412
+ EXPECT_EQ (1U , inspector->GetColumnIdsRecursive (0 ).size ());
413
+ EXPECT_EQ (1U , inspector->GetColumnIdsRecursive (1 ).size ());
414
+ for (const auto colId : inspector->GetColumnIdsRecursive (0 )) {
415
+ EXPECT_EQ (ENTupleColumnType::kSplitInt64 , inspector->GetColumnInspector (colId).GetType ());
416
+ }
417
+
418
+ EXPECT_EQ (1U , inspector->GetColumnIdsRecursive (2 ).size ());
419
+ for (const auto colId : inspector->GetColumnIdsRecursive (2 )) {
420
+ EXPECT_EQ (ENTupleColumnType::kSplitReal32 , inspector->GetColumnInspector (colId).GetType ());
421
+ }
422
+
423
+ EXPECT_EQ (2U , inspector->GetColumnIdsRecursive (3 ).size ());
424
+ }
425
+
426
+ TEST (RNTupleInspector, GetColumnIds)
427
+ {
428
+ FileRaii fileGuard (" test_ntuple_inspector_column_ids_recursive.root" );
429
+ {
430
+ auto model = RNTupleModel::Create ();
431
+ auto nFldInt1 = model->MakeField <std::int64_t >(" int1" );
432
+ auto nFldInt2 = model->MakeField <std::int64_t >(" int2" );
433
+ auto nFldFloat = model->MakeField <float >(" float" );
434
+ auto nFldFloatVec = model->MakeField <std::vector<float >>(" floatVec" );
435
+
436
+ auto writeOptions = RNTupleWriteOptions ();
437
+ writeOptions.SetCompression (505 );
438
+ auto ntuple = RNTupleWriter::Recreate (std::move (model), " ntuple" , fileGuard.GetPath (), writeOptions);
439
+ }
440
+
441
+ auto inspector = RNTupleInspector::Create (" ntuple" , fileGuard.GetPath ());
442
+
443
+ EXPECT_EQ (1U , inspector->GetColumnIds (0 ).size ());
444
+ EXPECT_EQ (1U , inspector->GetColumnIds (1 ).size ());
445
+ for (const auto colId : inspector->GetColumnIds (0 )) {
446
+ EXPECT_EQ (ENTupleColumnType::kSplitInt64 , inspector->GetColumnInspector (colId).GetType ());
447
+ }
448
+
449
+ EXPECT_EQ (1U , inspector->GetColumnIds (2 ).size ());
450
+ for (const auto colId : inspector->GetColumnIds (2 )) {
451
+ EXPECT_EQ (ENTupleColumnType::kSplitReal32 , inspector->GetColumnInspector (colId).GetType ());
452
+ }
453
+ EXPECT_EQ (1U , inspector->GetColumnIds (3 ).size ());
395
454
}
396
455
397
456
TEST (RNTupleInspector, ColumnTypes)
@@ -566,7 +625,7 @@ TEST(RNTupleInspector, PageSizeDistribution)
566
625
567
626
auto inspector = RNTupleInspector::Create (" ntuple" , fileGuard.GetPath ());
568
627
569
- int intColId = inspector->GetColumnsByType (ENTupleColumnType::kSplitInt64 )[0 ];
628
+ int intColId = inspector->GetColumnIds (ENTupleColumnType::kSplitInt64 )[0 ];
570
629
auto intPageSizeHisto = inspector->GetPageSizeDistribution (intColId);
571
630
EXPECT_STREQ (" pageSizeHist" , intPageSizeHisto->GetName ());
572
631
EXPECT_STREQ (Form (" Page size distribution for column with ID %d" , intColId), intPageSizeHisto->GetTitle ());
@@ -586,7 +645,7 @@ TEST(RNTupleInspector, PageSizeDistribution)
586
645
EXPECT_EQ (100 , floatPageSizeHisto->GetNbinsX ());
587
646
// Make sure that all page sizes are included in the histogram
588
647
int nFloatPages = 0 ;
589
- for (const auto colId : inspector->GetColumnsByType (ENTupleColumnType::kSplitReal32 )) {
648
+ for (const auto colId : inspector->GetColumnIds (ENTupleColumnType::kSplitReal32 )) {
590
649
nFloatPages += inspector->GetColumnInspector (colId).GetNPages ();
591
650
}
592
651
EXPECT_EQ (nFloatPages, floatPageSizeHisto->Integral ());
@@ -634,7 +693,7 @@ TEST(RNTupleInspector, PageSizeDistribution)
634
693
EXPECT_EQ (0 , emptyTypeHisto->Integral ());
635
694
636
695
// Requesting a histogram for a column without pages in the given RNTuple should give an empty histogram
637
- auto doubleColumns = inspector->GetColumnsByType (ENTupleColumnType::kSplitReal64 );
696
+ auto doubleColumns = inspector->GetColumnIds (ENTupleColumnType::kSplitReal64 );
638
697
ASSERT_EQ (1 , doubleColumns.size ());
639
698
auto emptyColumnHisto = inspector->GetPageSizeDistribution ({doubleColumns[0 ]});
640
699
EXPECT_EQ (0 , emptyColumnHisto->Integral ());
0 commit comments