Skip to content

Commit ed6f08e

Browse files
committed
[ntuple] Merger: accept different sizes for fields' logical column ids
Two field descriptors might legitimately have different numbers of elements in their LogicalColumnIds vectors due to having a different number of representations. The proper check to do is the one on the column cardinality, which makes sure that the same number of columns is actually used at a time.
1 parent cd91ac2 commit ed6f08e

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

tree/ntuple/src/RNTupleMerger.cxx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -452,18 +452,6 @@ static void MatchColumnRepresentations(const ROOT::RNTupleDescriptor &srcDesc, c
452452
const auto &srcColumns = srcField.GetLogicalColumnIds();
453453
const auto &dstColumns = dstField.GetLogicalColumnIds();
454454

455-
// Fields must have the same number of columns
456-
const auto srcNCols = srcColumns.size();
457-
const auto dstNCols = dstColumns.size();
458-
if (srcNCols != dstNCols) {
459-
std::stringstream ss;
460-
ss << "Field `" << srcField.GetFieldName()
461-
<< "` has a different number of columns than previously-seen field with the same name (old: " << dstNCols
462-
<< ", new: " << srcNCols << ")";
463-
errors.push_back(ss.str());
464-
return;
465-
}
466-
467455
// Fields must have the same cardinality
468456
const std::uint32_t srcColCardinality = srcField.GetColumnCardinality();
469457
const std::uint32_t dstColCardinality = dstField.GetColumnCardinality();
@@ -479,8 +467,8 @@ static void MatchColumnRepresentations(const ROOT::RNTupleDescriptor &srcDesc, c
479467
if (srcColCardinality == 0)
480468
return; // no columns to match
481469

482-
const auto srcNColReprs = srcNCols / srcColCardinality;
483-
const auto dstNColReprs = dstNCols / dstColCardinality;
470+
const auto srcNColReprs = srcColumns.size() / srcColCardinality;
471+
const auto dstNColReprs = dstColumns.size() / dstColCardinality;
484472

485473
// For each column representation of the source, check if it matches one in the descriptor.
486474
// If so, and if it doesn't match the destination's repr index, add a mapping for it.

0 commit comments

Comments
 (0)