| 137 | |
| 138 | template <typename To> |
| 139 | static 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 | |
| 171 | Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const IDataType * from_type_hint) |
no test coverage detected