I think that would be a reasonable JIRA request.  In addition I think
it would also make sense for the `pa.array` function to recognize
scalars:

>>> pa.array([1])
<pyarrow.lib.Int64Array object at 0x7fc52841b8e0>
[
  1
]
>>> pa.array([pa.scalar(1)])
# --ERR--

On Wed, Mar 30, 2022 at 7:01 PM Wenlei Xie <[email protected]> wrote:
>
> Hi,
>
> When play around PyArrow scalar, I found it seems to expect the input as a 
> "pure Python object", e.g. it cannot be a Python list of arrow scalar (such 
> as `[ pa.scalar(1) ]`:
>
> ```
> >>> import pyarrow as pa
> >>> pa.__version__
> '7.0.0'
>
> >>> pa.scalar([1])
> <pyarrow.ListScalar: [1]>
>
> >>> pa.scalar([pa.scalar(1)])
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "pyarrow/scalar.pxi", line 1040, in pyarrow.lib.scalar
>   File "pyarrow/error.pxi", line 143, in 
> pyarrow.lib.pyarrow_internal_check_status
>   File "pyarrow/error.pxi", line 99, in pyarrow.lib.check_status
> pyarrow.lib.ArrowInvalid: Could not convert <pyarrow.Int64Scalar: 1> with 
> type pyarrow.lib.Int64Scalar: did not recognize Python value type when 
> inferring an Arrow data type
> ```
> I am wondering if it's going to be supported in the future, or there is any 
> consideration not support that?
>
> Thanks!
>
> --
> Best Regards,
> Wenlei Xie
>
> Email: [email protected]

Reply via email to