[ 
https://issues.apache.org/jira/browse/ARROW-11495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated ARROW-11495:
-----------------------------------
    Labels: pull-request-available  (was: )

> [RUST] [datafusion] implementation for numerical_coercion is wrong
> ------------------------------------------------------------------
>
>                 Key: ARROW-11495
>                 URL: https://issues.apache.org/jira/browse/ARROW-11495
>             Project: Apache Arrow
>          Issue Type: Bug
>            Reporter: benwang li
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently `numerical_coercion` did not take consideration for integer 
> overflow, such as 
>  
>   
> {code:java}
> //代码占位符
> UIn8 + UIn8 should be UInt16, but now it's UInt8
> UInt16 * UInt16 should be UInt64, but now it's UInt16
> {code}
> ClickHouse handled it well, maybe we should learn it from ClickHouse
>  
> {code:java}
> //代码占位符 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; };
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to