apache / apache/arrow

[Python] Allow PyCapsule Interface in `pyarrow.scalar` constructor?

Open
#44,232 4 comments 1 reaction 1 assignee Claimed by @Lukedowling444 View on GitHub
Component: Python Status: needs champion Type: enhancement
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the enhancement requested

Should the `pyarrow.scalar` constructor check for the PyCapsule Interface? It would allow any input with `__arrow_c_array__`, additionally validating that the input is a length-1 array.

In this case it's less important for the _speed_ of sharing large data across multiple libraries than it is for the reliability of communicating Arrow data.

An existing workaround is to use `pa.array(other_scalar)[0]`, so it's not clear whether the `pa.scalar` constructor should or should not check for this.

cc @jorisvandenbossche

### Component(s)

Python

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.