MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / castToValue

Method castToValue

src/DataTypes/DataTypeEnum.cpp:182–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181template <typename Type>
182Field DataTypeEnum<Type>::castToValue(const Field & value_or_name) const
183{
184 if (value_or_name.getType() == Field::Types::String)
185 {
186 return this->getValue(value_or_name.safeGet<String>());
187 }
188 if (value_or_name.getType() == Field::Types::Int64 || value_or_name.getType() == Field::Types::UInt64)
189 {
190 Int64 value = value_or_name.safeGet<Int64>();
191 checkOverflow<Type>(value);
192 this->getNameForValue(static_cast<Type>(value)); /// Check correctness
193 return value;
194 }
195 throw Exception(ErrorCodes::BAD_TYPE_OF_FIELD, "DataTypeEnum: Unsupported type of field {}", value_or_name.getTypeName());
196}
197
198
199template <typename Type>

Callers 4

insertValueMethod · 0.80
insertValueFunction · 0.80
createDeserializeFnMethod · 0.80
convertFieldToTypeImplFunction · 0.80

Calls 5

getNameForValueMethod · 0.80
ExceptionClass · 0.50
getTypeMethod · 0.45
getValueMethod · 0.45
getTypeNameMethod · 0.45

Tested by

no test coverage detected