Skip to content

[C++] Enable Array creation from Scalar #40318

@vyasr

Description

@vyasr

Describe the enhancement requested

Currently creating an ArrowArray from a Scalar requires going through the Builder interface. While this is fine as a general solution, a common special case is the creation of an Array from a single Scalar (possibly copying that Scalar N times). Abstracting out the handling of different types could be helpful for this case. If there is interest in this feature, there is code that I wrote for this task in cudf that could easily be extracted into arrow C++ (we're likely to remove that functionality from libcudf).

Concretely, this would be something like an API with the signature:

arrow::Array from_scalar(arrow::Scalar const& input, size_type N=1)

Apologies if there is such a function somewhere in the C++ and I missed it.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions