MCPcopy Create free account
hub / github.com/ByConity/ByConity / tryMakeNullableForMapValue

Function tryMakeNullableForMapValue

src/DataTypes/DataTypeMap.cpp:134–153  ·  view source on GitHub ↗

If type is not nullable, wrap it to be nullable

Source from the content-addressed store, hash-verified

132
133/// If type is not nullable, wrap it to be nullable
134static DataTypePtr tryMakeNullableForMapValue(const DataTypePtr & type)
135{
136 if (type->isNullable())
137 return type;
138 /// When type is low cardinality, its dictionary type must be nullable, see more detail in DataTypeLowCardinality::canBeByteMapValueType()
139 if (const auto * low_cardinality_type = typeid_cast<const DataTypeLowCardinality *>(type.get()))
140 {
141 if (const auto * nullable_type = typeid_cast<const DataTypeNullable *>(low_cardinality_type->getDictionaryType().get()))
142 return type;
143 else
144 throw Exception(ErrorCodes::BAD_ARGUMENTS, "Can not get map implicit column data type of lowcardinality type.");
145 }
146 else
147 {
148 if (type->canBeInsideNullable())
149 return makeNullable(type);
150 else
151 throw Exception(ErrorCodes::BAD_ARGUMENTS, "Can not get map implicit column data type of type {}.", type->getName());
152 }
153}
154
155DataTypePtr DataTypeMap::getValueTypeForImplicitColumn() const
156{

Callers 1

Calls 6

makeNullableFunction · 0.70
ExceptionClass · 0.50
isNullableMethod · 0.45
getMethod · 0.45
canBeInsideNullableMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected