Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Currently `numerical_coercion` did not take consideration for integer overflow, such as
//代码占位符
UIn8 + UIn8 should be UInt16, but now it's UInt8
UInt16 * UInt16 should be UInt64, but now it's UInt16
ClickHouse handled it well, maybe we should learn it from ClickHouse
//代码占位符 From https://github.com/ClickHouse/ClickHouse/blob/bd81f43ecb/src/DataTypes/NumberTraits.h template <bool is_signed, bool is_floating, size_t size> struct Construct { usingType=Error; } ; template <> struct Construct<false, false, 1> { using Type = UInt8; }; template <> struct Construct<false, false, 2> { using Type = UInt16; }; template <> struct Construct<false, false, 4> { using Type = UInt32; }; template <> struct Construct<false, false, 8> { using Type = UInt64; }; template <> struct Construct<false, false, 16> { using Type = UInt256; }; /// TODO: we cannot use our UInt128 here template <> struct Construct<false, false, 32> { using Type = UInt256; }; template <> struct Construct<false, true, 1> { using Type = Float32; }; template <> struct Construct<false, true, 2> { using Type = Float32; }; template <> struct Construct<false, true, 4> { using Type = Float32; }; template <> struct Construct<false, true, 8> { using Type = Float64; }; template <> struct Construct<true, false, 1> { using Type = Int8; }; template <> struct Construct<true, false, 2> { using Type = Int16; }; template <> struct Construct<true, false, 4> { using Type = Int32; }; template <> struct Construct<true, false, 8> { using Type = Int64; }; template <> struct Construct<true, false, 16> { using Type = Int128; }; template <> struct Construct<true, false, 32> { using Type = Int256; }; template <> struct Construct<true, true, 1> { using Type = Float32; }; template <> struct Construct<true, true, 2> { using Type = Float32; }; template <> struct Construct<true, true, 4> { using Type = Float32; }; template <> struct Construct<true, true, 8> { using Type = Float64; };
Attachments
Issue Links
- links to