You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Vlad Firoiu (Jira)" <ji...@apache.org> on 2021/12/09 21:14:00 UTC

[jira] [Updated] (ARROW-15050) pyarrow.scalar doesn't accept nested pyarrow values

     [ https://issues.apache.org/jira/browse/ARROW-15050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vlad Firoiu updated ARROW-15050:
--------------------------------
    Description: 
Easiest explained in code:

{code:python}
import pyarrow as pa

t1 = pa.struct([('x', pa.int64())])
t2 = pa.struct([('y', t1)])

t1_py = {'x', 0}
t1_pa = pa.scalar(t1_py, type=t1)

t2_py = {'y': {'x': 0}}
t2_pa = pa.scalar(t2_py, type=t2)  # works

t2_mixed = {'y': t1_pa}
t2_pa_mix = pa.scalar(t2_mixed, type=t2)  # fails
assert t2_pa_mix == t2_pa
{code}

Is there some other way to construct the pyarrow struct value corresponding to {{t2_pa}} given {{t1_pa}} directly, without going through python first (i.e. constructing {{t1_py}})?

  was:
Easiest explained in code:

{code:python}
import pyarrow as pa

t1 = pa.struct([('x', pa.int64())])
t2 = pa.struct([('y', t1)])

t1_py = {'x', 0}
t1_pa = pa.scalar(t1_py, type=t1)

t2_py = {'y': {'x': 0}}
t2_pa = pa.scalar(t2_py, type=t2)  # works

t2_mixed = {'y': t1_pa}
t2_pa_mix = pa.scalar(t2_mixed, type=t2)  # fails
assert t2_pa_mix == t2_pa
{code}

Is there some other way to construct pyarrow struct value corresponding to {{t2_pa}} given {{t1_pa}} directly, without going into python first?


> pyarrow.scalar doesn't accept nested pyarrow values
> ---------------------------------------------------
>
>                 Key: ARROW-15050
>                 URL: https://issues.apache.org/jira/browse/ARROW-15050
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Vlad Firoiu
>            Priority: Major
>
> Easiest explained in code:
> {code:python}
> import pyarrow as pa
> t1 = pa.struct([('x', pa.int64())])
> t2 = pa.struct([('y', t1)])
> t1_py = {'x', 0}
> t1_pa = pa.scalar(t1_py, type=t1)
> t2_py = {'y': {'x': 0}}
> t2_pa = pa.scalar(t2_py, type=t2)  # works
> t2_mixed = {'y': t1_pa}
> t2_pa_mix = pa.scalar(t2_mixed, type=t2)  # fails
> assert t2_pa_mix == t2_pa
> {code}
> Is there some other way to construct the pyarrow struct value corresponding to {{t2_pa}} given {{t1_pa}} directly, without going through python first (i.e. constructing {{t1_py}})?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)