[ 
https://issues.apache.org/jira/browse/ARROW-9022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17125012#comment-17125012
 ] 

Ben Kietzman commented on ARROW-9022:
-------------------------------------

Replicating https://github.com/apache/arrow/pull/7341#issuecomment-638241193 
here:

I'm not sure this approach is desirable. For one thing this leads to 
inconsistent handling of 64 bit integer types, which are currently allowed to 
overflow (NB: that means we would incur undefined behavior for int64).

There are a few other approaches we could take (ordered by personal preference):

-   define explicit overflow behavior for signed integer operands (for example 
if we declared that add(i8(a), i8(b)) will always be equivalent to i8(i16(a) + 
i16(b)) then we could instantiate only unsigned addition kernels)
-   raise an error on signed overflow
-   provide ArithmeticOptions::overflow_behavior and allow users to choose 
between these
-   require users to pass arguments which will not overflow


> [C++][Compute] Make Add function safe for numeric limits
> --------------------------------------------------------
>
>                 Key: ARROW-9022
>                 URL: https://issues.apache.org/jira/browse/ARROW-9022
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Krisztian Szucs
>            Assignee: Krisztian Szucs
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.0.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Currently the output type of the Add function is identical with the argument 
> types which makes it unsafe to add numeric limit values, so instead of using 
> {{(int8, int8) -> int8}} signature we should use {{((int8, int8) -> int16}}.



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

Reply via email to