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

Function convertDecimalType

src/Interpreters/convertFieldToType.cpp:139–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138template <typename To>
139static Field convertDecimalType(const Field & from, const To & type)
140{
141 if (from.getType() == Field::Types::UInt64)
142 return convertIntToDecimalType<UInt64>(from, type);
143 if (from.getType() == Field::Types::Int64)
144 return convertIntToDecimalType<Int64>(from, type);
145 if (from.getType() == Field::Types::UInt128)
146 return convertIntToDecimalType<UInt128>(from, type);
147 if (from.getType() == Field::Types::Int128)
148 return convertIntToDecimalType<Int128>(from, type);
149 if (from.getType() == Field::Types::UInt256)
150 return convertIntToDecimalType<UInt256>(from, type);
151 if (from.getType() == Field::Types::Int256)
152 return convertIntToDecimalType<Int256>(from, type);
153
154 if (from.getType() == Field::Types::String)
155 return convertStringToDecimalType(from, type);
156
157 if (from.getType() == Field::Types::Decimal32)
158 return convertDecimalToDecimalType<Decimal32>(from, type);
159 if (from.getType() == Field::Types::Decimal64)
160 return convertDecimalToDecimalType<Decimal64>(from, type);
161 if (from.getType() == Field::Types::Decimal128)
162 return convertDecimalToDecimalType<Decimal128>(from, type);
163 if (from.getType() == Field::Types::Decimal256)
164 return convertDecimalToDecimalType<Decimal256>(from, type);
165
166 throw Exception("Type mismatch in IN or VALUES section. Expected: " + type.getName() + ". Got: "
167 + Field::Types::toString(from.getType()), ErrorCodes::TYPE_MISMATCH);
168}
169
170
171Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const IDataType * from_type_hint)

Callers 1

convertFieldToTypeImplFunction · 0.85

Calls 5

ExceptionClass · 0.70
toStringFunction · 0.70
getTypeMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected