You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by Li Jin <ic...@gmail.com> on 2023/03/24 16:07:22 UTC

Zero copy cast kernels

Hello,

I recently found myself casting an int64 (nanos from epoch) into a nano
timestamp column with the C++ cast kernel (via Acero).

I expect this to be zero copy but I wonder if there is a way to check which
casts are zero copy and which are not?

Li

Re: Zero copy cast kernels

Posted by Li Jin <ic...@gmail.com>.
Thanks Rok!

Original question is to asking for a way to "verify if a cast if zero copy
by read source code / documentation", and not "verify a cast if zero copy
programmatically" but I noticed by reading the test file that int64 to
micro is indeed zero copy and I expect nanos to be the same
https://github.com/apache/arrow/blob/e7d6c13d4ae3d8df0e9b668468b990f35c8a9556/cpp/src/arrow/compute/kernels/scalar_cast_test.cc#L1546

On Fri, Mar 24, 2023 at 12:36 PM Rok Mihevc <ro...@gmail.com> wrote:

> For scalar casting tests we use CheckCastZeroCopy [1] which you could
> reuse.
>
> [1]
>
> https://github.com/apache/arrow/blob/e7d6c13d4ae3d8df0e9b668468b990f35c8a9556/cpp/src/arrow/compute/kernels/scalar_cast_test.cc#L128-L138
>
> Rok
>

Re: Zero copy cast kernels

Posted by Rok Mihevc <ro...@gmail.com>.
For scalar casting tests we use CheckCastZeroCopy [1] which you could reuse.

[1]
https://github.com/apache/arrow/blob/e7d6c13d4ae3d8df0e9b668468b990f35c8a9556/cpp/src/arrow/compute/kernels/scalar_cast_test.cc#L128-L138

Rok