What do open source analytic database systems do? I don't think we should deviate from the behavior of these systems. For example, you can see that Apache Impala uses unsigned arithmetic on signed integers
https://github.com/apache/impala/blob/5c69e7ba583297dc886652ac5952816882b928af/be/src/exprs/operators-ir.cc#L38 On Wed, Jun 3, 2020 at 9:47 AM Ben Kietzman <ben.kietz...@rstudio.com> wrote: > > https://github.com/apache/arrow/pull/7341#issuecomment-638241193 > > How should arithmetic kernels handle integer overflow? > > The approach currently taken in the linked PR is to promote such that > overflow will not occur, for example `(int8, int8)->int16` and `(uint16, > uint16)->uint32`. > > I'm not sure that's desirable. For one thing this leads to inconsistent > handling of 64 bit integer types, which are currently allowed to overflow > since we cannot promote further (NB: that means this kernel includes > 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