Merge pull request #36489 from awakeljw/fork_chmaster

fix ConvertDecimalType unexpected behavior
This commit is contained in:
Kseniia Sumarokova 2022-04-25 13:23:54 +02:00 committed by GitHub
commit 2106a7b895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -193,6 +193,7 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
if (const auto * ptype = typeid_cast<const DataTypeDecimal<Decimal32> *>(&type)) return convertDecimalType(src, *ptype);
if (const auto * ptype = typeid_cast<const DataTypeDecimal<Decimal64> *>(&type)) return convertDecimalType(src, *ptype);
if (const auto * ptype = typeid_cast<const DataTypeDecimal<Decimal128> *>(&type)) return convertDecimalType(src, *ptype);
if (const auto * ptype = typeid_cast<const DataTypeDecimal<Decimal256> *>(&type)) return convertDecimalType(src, *ptype);
if (which_type.isEnum() && (src.getType() == Field::Types::UInt64 || src.getType() == Field::Types::Int64))
{

View File

@ -0,0 +1,4 @@
1
2
3
4

View File

@ -0,0 +1,4 @@
SELECT * FROM VALUES('x Decimal32(0)', (1));
SELECT * FROM VALUES('x Decimal64(0)', (2));
SELECT * FROM VALUES('x Decimal128(0)', (3));
SELECT * FROM VALUES('x Decimal256(0)', (4));