You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jorisvandenbossche (via GitHub)" <gi...@apache.org> on 2023/04/21 19:34:36 UTC

[GitHub] [arrow] jorisvandenbossche commented on issue #35273: BUG: pyarrow.compute.round fails for large integer within int64

jorisvandenbossche commented on issue #35273:
URL: https://github.com/apache/arrow/issues/35273#issuecomment-1518256692

   The issue here is that the "round" kernel is only implemented for floats / decimals:
   
   ```
   In [20]: pa.compute.get_function("round").kernels
   Out[20]: 
   [ScalarKernel<(Type::FLOAT) -> float>,
    ScalarKernel<(Type::DOUBLE) -> double>,
    ScalarKernel<(Type::DECIMAL128) -> computed>,
    ScalarKernel<(Type::DECIMAL256) -> computed>,
    ScalarKernel<(Type::NA) -> null>]
   ```
   
   And so for numeric types we do have some automatic type casting to find a kernel, which in this case doesn't really do what would be expected (the failure you see is from trying to cast int to float, and the int is too large to to be faithfully represented as a float).
   
   So on the short term, I think pandas can just avoid calling the kernel on integers, as it should be a no-op anyway. And it might be more convenient that pyarrow adds a dummy kernel for the integer types as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org