Re: Turn a vector of Scalar to an Array/ArrayData of the same datatype

2023-06-16 Thread Li Jin
Thanks Jin! That's perfect. On Thu, Jun 15, 2023 at 11:21 PM Jin Shang wrote: > Hi Li, > > I've faced this issue before, and I ended up using a generic ArrayBuilder, > for example: > > ```cpp > auto type = int32(); > std::vector> scalars = {MakeScalar(1), > MakeScalar(2)}; > >

Re: Turn a vector of Scalar to an Array/ArrayData of the same datatype

2023-06-15 Thread Jin Shang
Hi Li, I've faced this issue before, and I ended up using a generic ArrayBuilder, for example: ```cpp auto type = int32(); std::vector> scalars = {MakeScalar(1), MakeScalar(2)}; ARROW_ASSIGN_OR_RAISE(std::unique_ptr builder, MakeBuilder(type));

Turn a vector of Scalar to an Array/ArrayData of the same datatype

2023-06-15 Thread Li Jin
Hi, I find myself in need of a function to turn a vector of Scalar to an Array of the same datatype. The data type is known at the runtime. e.g. shared_ptr concat_scalars(vector values. shared_ptr type); I wonder if I need to use sth like Scalar::Accept(ScalarVisitor*) or is there an