You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2022/10/11 07:43:00 UTC

[jira] [Resolved] (ARROW-17826) [Python] Allow scalars when creating expression from compute kernels

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

Joris Van den Bossche resolved ARROW-17826.
-------------------------------------------
    Fix Version/s: 10.0.0
       Resolution: Fixed

Issue resolved by pull request 14360
[https://github.com/apache/arrow/pull/14360]

> [Python] Allow scalars when creating expression from compute kernels
> --------------------------------------------------------------------
>
>                 Key: ARROW-17826
>                 URL: https://issues.apache.org/jira/browse/ARROW-17826
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Joris Van den Bossche
>            Assignee: Miles Granger
>            Priority: Major
>              Labels: expressions, pull-request-available
>             Fix For: 10.0.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> We can create an expression (eg for a projection) using the compute kernels and passing expressions as arguments. But currently, all other arguments need to be expressions:
> {code:python}
> >>> pc.add(pc.field("a"), pc.field("b"))    # this works
> <pyarrow.compute.Expression add(a, b)>
> >>> pc.add(pc.field("a"), 1)   # this fails when passing scalar (same for pa.scalar(1))
> ...
> TypeError: only other expressions allowed as arguments
> {code}
> You can still pass a scalar expression ({{pc.scalar(1)}}, note {{pc.}} not {{pa.}}), but I think for scalars it would be a nice usability improvement if it's not needed to manually convert your python or pyarrow scalar to a scalar expression. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)