apache / apache/arrow

[R] Arrays containing -2147483648 are converted to NA in R

Open
#40,194 1 comment 0 reactions 0 assignees View on GitHub
Component: R Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

R uses -2147483648 (int32_min) to represent missing integer values (`NA`). When converting Arrow arrays to R using the C API and then casting to R vectors using `as.vector`, arrays containing -2147483649 and below are converted to bit64::integer64, but if the minimum value of the array is exactly -2147483648, all the -2147483648s are converted to NA. This is an edge case but it's an important one, because int32_min is often used as a special sentinel value.

Arrow should update the out-of-range check that decides whether to convert to bit64::integer64, to use -2147483647 as the minimum valid int32 rather than -2147483648.

### Component(s)

R

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.