@@ -797,7 +797,7 @@ const ROOT::RFieldBase::RColumnRepresentations &ROOT::RNullableField::GetColumnR
797
797
{ENTupleColumnType::kIndex64 },
798
798
{ENTupleColumnType::kSplitIndex32 },
799
799
{ENTupleColumnType::kIndex32 }},
800
- {});
800
+ {{} });
801
801
return representations;
802
802
}
803
803
@@ -808,7 +808,8 @@ void ROOT::RNullableField::GenerateColumns()
808
808
809
809
void ROOT::RNullableField::GenerateColumns (const ROOT::RNTupleDescriptor &desc)
810
810
{
811
- GenerateColumnsImpl<ROOT::Internal::RColumnIndex>(desc);
811
+ if (!fIsEvolvedFromInnerType )
812
+ GenerateColumnsImpl<ROOT::Internal::RColumnIndex>(desc);
812
813
}
813
814
814
815
std::size_t ROOT::RNullableField::AppendNull ()
@@ -830,8 +831,13 @@ void ROOT::RNullableField::ReconcileOnDiskField(const RNTupleDescriptor &desc)
830
831
static const std::vector<std::string> prefixes = {" std::optional<" , " std::unique_ptr<" };
831
832
832
833
const auto &fieldDesc = desc.GetFieldDescriptor (GetOnDiskId ());
833
- EnsureMatchingOnDiskField (fieldDesc, kDiffTypeName );
834
- EnsureMatchingTypePrefix (fieldDesc, prefixes);
834
+ try {
835
+ EnsureMatchingOnDiskField (fieldDesc, kDiffTypeName );
836
+ EnsureMatchingTypePrefix (fieldDesc, prefixes);
837
+ } catch (const RException &) {
838
+ fSubfields [0 ]->SetOnDiskId (GetOnDiskId ());
839
+ fIsEvolvedFromInnerType = true ;
840
+ }
835
841
}
836
842
837
843
ROOT::RNTupleLocalIndex ROOT::RNullableField::GetItemIndex (ROOT::NTupleSize_t globalIndex)
@@ -900,16 +906,28 @@ void *ROOT::RUniquePtrField::PrepareRead(void *to, bool hasOnDiskValue)
900
906
901
907
void ROOT::RUniquePtrField::ReadGlobalImpl (ROOT::NTupleSize_t globalIndex, void *to)
902
908
{
903
- auto itemIndex = GetItemIndex (globalIndex);
904
- const bool hasOnDiskValue = itemIndex.GetIndexInCluster () != ROOT::kInvalidNTupleIndex ;
909
+ RNTupleLocalIndex itemIndex;
910
+ if (!fIsEvolvedFromInnerType )
911
+ itemIndex = GetItemIndex (globalIndex);
912
+ const bool hasOnDiskValue = fIsEvolvedFromInnerType || itemIndex.GetIndexInCluster () != ROOT::kInvalidNTupleIndex ;
905
913
auto valuePtr = PrepareRead (to, hasOnDiskValue);
906
- if (hasOnDiskValue)
907
- CallReadOn (*fSubfields [0 ], itemIndex, valuePtr);
914
+ if (hasOnDiskValue) {
915
+ if (fIsEvolvedFromInnerType ) {
916
+ CallReadOn (*fSubfields [0 ], globalIndex, valuePtr);
917
+ } else {
918
+ CallReadOn (*fSubfields [0 ], itemIndex, valuePtr);
919
+ }
920
+ }
908
921
}
909
922
910
923
void ROOT::RUniquePtrField::ReadInClusterImpl (ROOT::RNTupleLocalIndex localIndex, void *to)
911
924
{
912
- auto itemIndex = GetItemIndex (localIndex);
925
+ RNTupleLocalIndex itemIndex;
926
+ if (!fIsEvolvedFromInnerType ) {
927
+ itemIndex = GetItemIndex (localIndex);
928
+ } else {
929
+ itemIndex = localIndex;
930
+ }
913
931
const bool hasOnDiskValue = itemIndex.GetIndexInCluster () != ROOT::kInvalidNTupleIndex ;
914
932
auto valuePtr = PrepareRead (to, hasOnDiskValue);
915
933
if (hasOnDiskValue)
@@ -992,16 +1010,28 @@ void ROOT::ROptionalField::PrepareRead(void *to, bool hasOnDiskValue)
992
1010
993
1011
void ROOT::ROptionalField::ReadGlobalImpl (ROOT::NTupleSize_t globalIndex, void *to)
994
1012
{
995
- auto itemIndex = GetItemIndex (globalIndex);
996
- const bool hasOnDiskValue = itemIndex.GetIndexInCluster () != ROOT::kInvalidNTupleIndex ;
1013
+ RNTupleLocalIndex itemIndex;
1014
+ if (!fIsEvolvedFromInnerType )
1015
+ itemIndex = GetItemIndex (globalIndex);
1016
+ const bool hasOnDiskValue = fIsEvolvedFromInnerType || itemIndex.GetIndexInCluster () != ROOT::kInvalidNTupleIndex ;
997
1017
PrepareRead (to, hasOnDiskValue);
998
- if (hasOnDiskValue)
999
- CallReadOn (*fSubfields [0 ], itemIndex, to);
1018
+ if (hasOnDiskValue) {
1019
+ if (fIsEvolvedFromInnerType ) {
1020
+ CallReadOn (*fSubfields [0 ], globalIndex, to);
1021
+ } else {
1022
+ CallReadOn (*fSubfields [0 ], itemIndex, to);
1023
+ }
1024
+ }
1000
1025
}
1001
1026
1002
1027
void ROOT::ROptionalField::ReadInClusterImpl (ROOT::RNTupleLocalIndex localIndex, void *to)
1003
1028
{
1004
- auto itemIndex = GetItemIndex (localIndex);
1029
+ RNTupleLocalIndex itemIndex;
1030
+ if (!fIsEvolvedFromInnerType ) {
1031
+ itemIndex = GetItemIndex (localIndex);
1032
+ } else {
1033
+ itemIndex = localIndex;
1034
+ }
1005
1035
const bool hasOnDiskValue = itemIndex.GetIndexInCluster () != ROOT::kInvalidNTupleIndex ;
1006
1036
PrepareRead (to, hasOnDiskValue);
1007
1037
if (hasOnDiskValue)
0 commit comments