Skip to content

Conversation

srinathk10
Copy link
Contributor

Why are these changes needed?

Handle Arrow Array null types in to_numpy

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Srinath Krishnamachari <[email protected]>
@srinathk10 srinathk10 requested a review from a team as a code owner April 24, 2025 03:44
@srinathk10 srinathk10 added the go add ONLY when ready to merge, run all tests label Apr 24, 2025
if isinstance(array, pa.Array):
if pa.types.is_null(array.type):
return np.full(len(array), np.nan, dtype=np.float32)
return array.to_numpy(zero_copy_only=zero_copy_only)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array.to_numpy(zero_copy_only=zero_copy_only, na_value=np.nan)

this would be simpler

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, this doesn't work for zero_copy_only

@raulchen raulchen merged commit 0bc6ec8 into master Apr 24, 2025
5 checks passed
@raulchen raulchen deleted the srinathk10-to_numpy-null-types branch April 24, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-backlog go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants