Skip to content

Commit 7a1cf08

Browse files
committed
[ntuple] fix automatic schema evolution into map
Don't evolve an on-disk std::set<std::pair<...>> into a std::map<...>, because the uniqueness of the pair does not imply uniqueness of the key.
1 parent a460d3f commit 7a1cf08

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

tree/ntuple/src/RFieldMeta.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,7 @@ std::unique_ptr<ROOT::RFieldBase> ROOT::RMapField::CloneImpl(std::string_view ne
936936

937937
void ROOT::RMapField::ReconcileOnDiskField(const RNTupleDescriptor &desc)
938938
{
939-
static const std::vector<std::string> prefixesRegular = {"std::map<", "std::unordered_map<", "std::set<",
940-
"std::unordered_set<"};
939+
static const std::vector<std::string> prefixesRegular = {"std::map<", "std::unordered_map<"};
941940

942941
EnsureMatchingOnDiskField(desc, kDiffTypeName).ThrowOnError();
943942

tree/ntuple/test/ntuple_evolution_type.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,8 @@ TEST(RNTupleEvolution, Collections)
628628
ReadCollectionFail<std::map<short int, short int>, true>("proxyOfPairs", fileGuard.GetPath());
629629
ReadCollectionFail<std::map<short int, short int>, true>("vectorOfPairs", fileGuard.GetPath());
630630
ReadCollectionFail<std::map<short int, short int>, true>("rvecOfPairs", fileGuard.GetPath());
631-
ReadCollection<std::map<short int, short int>, true>("setOfPairs", fileGuard.GetPath());
632-
ReadCollection<std::map<short int, short int>, true>("unordered_setOfPairs", fileGuard.GetPath());
631+
ReadCollectionFail<std::map<short int, short int>, true>("setOfPairs", fileGuard.GetPath());
632+
ReadCollectionFail<std::map<short int, short int>, true>("unordered_setOfPairs", fileGuard.GetPath());
633633
ReadCollectionFail<std::map<short int, short int>, true>("multisetOfPairs", fileGuard.GetPath());
634634
ReadCollectionFail<std::map<short int, short int>, true>("unordered_multisetOfPairs", fileGuard.GetPath());
635635
ReadCollection<std::map<short int, short int>, true>("unordered_map", fileGuard.GetPath());
@@ -640,8 +640,8 @@ TEST(RNTupleEvolution, Collections)
640640
ReadCollectionFail<std::unordered_map<short int, short int>, true>("proxyOfPairs", fileGuard.GetPath());
641641
ReadCollectionFail<std::unordered_map<short int, short int>, true>("vectorOfPairs", fileGuard.GetPath());
642642
ReadCollectionFail<std::unordered_map<short int, short int>, true>("rvecOfPairs", fileGuard.GetPath());
643-
ReadCollection<std::unordered_map<short int, short int>, true>("setOfPairs", fileGuard.GetPath());
644-
ReadCollection<std::unordered_map<short int, short int>, true>("unordered_setOfPairs", fileGuard.GetPath());
643+
ReadCollectionFail<std::unordered_map<short int, short int>, true>("setOfPairs", fileGuard.GetPath());
644+
ReadCollectionFail<std::unordered_map<short int, short int>, true>("unordered_setOfPairs", fileGuard.GetPath());
645645
ReadCollectionFail<std::unordered_map<short int, short int>, true>("multisetOfPairs", fileGuard.GetPath());
646646
ReadCollectionFail<std::unordered_map<short int, short int>, true>("unordered_multisetOfPairs", fileGuard.GetPath());
647647
ReadCollection<std::unordered_map<short int, short int>, true>("map", fileGuard.GetPath());

0 commit comments

Comments
 (0)