Re: Cast from Array to Array and Array

2018-11-14 Thread Wes McKinney
https://issues.apache.org/jira/browse/ARROW-3790 On Wed, Nov 14, 2018 at 9:03 AM Wes McKinney wrote: > > There's a logical error here > > https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/cast.cc#L239 > > The cast > > constexpr in_type kMax = > static_cast(std::numeric_limi

Re: Cast from Array to Array and Array

2018-11-14 Thread Wes McKinney
There's a logical error here https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/cast.cc#L239 The cast constexpr in_type kMax = static_cast(std::numeric_limits::max()); is overflowing int32_t This code path was only written for the unsigned-to-signed case. The functors ne

Re: Cast from Array to Array and Array

2018-11-14 Thread Francois Saint-Jacques
Seems like the type combination you're using (int32 -> uint32) and (int32 -> uint64) don't match the following pattern-matching https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/cast.cc#L191-L192 which avoid using "safe" cast and revert to the following cast implementation

Re: Cast from Array to Array and Array

2018-11-14 Thread Wes McKinney
Yes, it looks buggy to me, see In [12]: arr = pa.array([-1, -2, -3], type='int32') In [13]: arr.cast('uint8') --- ArrowInvalid Traceback (most recent call last) in () > 1 arr.cast('uint8') ~

Cast from Array to Array and Array

2018-11-14 Thread Romain Francois
I'm implementing Array$cast() in the R package, i.e. https://issues.apache.org/jira/browse/ARROW-3741?filter=12344983 I'm seeing some weird results when casting from int32 to uint32 and uint64 (I'm expecting errors here as it's supposed to be safe https://github.com/apache/arrow/pull/2959#issue