13001 {
13002 switch (type.id()) {
13003 case LogicalTypeId::STRUCT: {
13004 if (!type.AuxInfo()) {
13005 return func(type);
13006 }
13007 auto children = StructType::GetChildTypes(type);
13008 for (auto &child : children) {
13009 child.second = VisitReplace(child.second, func);
13010 }
13011 return func(LogicalType::STRUCT(children));
13012 }
13013 case LogicalTypeId::UNION: {
13014 if (!type.AuxInfo()) {
13015 return func(type);
13016 }
13017 auto children = UnionType::CopyMemberTypes(type);
13018 for (auto &child : children) {
13019 child.second = VisitReplace(child.second, func);
13020 }
13021 return func(LogicalType::UNION(children));
13022 }
13023 case LogicalTypeId::LIST: {
13024 if (!type.AuxInfo()) {
13025 return func(type);
13026 }
13027 const auto &child = ListType::GetChildType(type);
13028 return func(LogicalType::LIST(VisitReplace(child, func)));
13029 }
13030 case LogicalTypeId::ARRAY: {
13031 if (!type.AuxInfo()) {
13032 return func(type);
13033 }
13034 const auto &child = ArrayType::GetChildType(type);
13035 return func(LogicalType::ARRAY(VisitReplace(child, func), ArrayType::GetSize(type)));
13036 }
13037 case LogicalTypeId::MAP: {
13038 if (!type.AuxInfo()) {
13039 return func(type);
13040 }
13041 const auto &key = MapType::KeyType(type);
13042 const auto &value = MapType::ValueType(type);
13043 return func(LogicalType::MAP(VisitReplace(key, func), VisitReplace(value, func)));
13044 }
13045 default:
13046 return func(type);
13047 }
13048}