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

[jira] [Resolved] (ARROW-14732) [Python] Improve error message in compute functions when passing wrong positional/keyword arguments

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

Antoine Pitrou resolved ARROW-14732.
------------------------------------
    Fix Version/s: 7.0.0
       Resolution: Fixed

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

> [Python] Improve error message in compute functions when passing wrong positional/keyword arguments
> ---------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-14732
>                 URL: https://issues.apache.org/jira/browse/ARROW-14732
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Joris Van den Bossche
>            Assignee: Joris Van den Bossche
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 7.0.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> From https://stackoverflow.com/questions/69990087/how-to-use-pyarrow-compute-is-in-function
> Small example of the current error messages:
> {code:python}
> array1 = pa.array([1,2,3,4])
> array2 = pa.array([1,4])
> import pyarrow.compute as pc
> # Using positional for value_set as well (the signature indicates with * that this are keyword
> # only arguments, but the error message is still confusing compared to plain python
> >>> pc.is_in(array1, array2)
> ...
> ArrowInvalid: Function is_in accepts 1 arguments but attempted to look up kernel(s) with 2
> # Using keyword for the first argument (which is allowed in pure python functions)
> # gives confusing error message because it passes it to the options
> >>> pc.is_in(values=array1,value_set=array2)
> ...
> ~/scipy/repos/arrow/python/pyarrow/_compute.pyx in pyarrow._compute.SetLookupOptions.__init__()
> TypeError: __init__() got an unexpected keyword argument 'values'
> {code}
> I think it should be quite easy to improve the error messaging on this front, since we know how many arguments the kernel takes.
> cc [~amol-] 



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