New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-15210: [Python] Pyarrow compute functions convert args with __arrow_array__
.
#12048
Conversation
|
LGTM! Thanks for fixing this @coady! |
@coady Can you rebase this on git master to fix CI failures? |
@@ -416,7 +416,8 @@ cdef class MetaFunction(Function): | |||
|
|||
cdef _pack_compute_args(object values, vector[CDatum]* out): | |||
for val in values: | |||
if isinstance(val, (list, np.ndarray)): | |||
if isinstance(val, (list, np.ndarray)) or \ | |||
hasattr(val, '__arrow_array__'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are adding this specific check, should we maybe also add a hasattr(val, "__array__")
for also including "numpy-array-likes"?
(although that can maybe also decided in a separate JIRA)
It's just that the current set of types we try to convert to an array is somewhat arbitrary. List and np.ndarray are of course the logical things to support. But the current check would mean that, for example, a pd.Series or a generic sequence are not accepted (while asarray
will accept those)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I opened ARROW-15202 separately because pa.array
also doesn't check for __array__
. So not supporting __arrow_array__
here seemed like a bug to me, whereas supporting __array__
in general seemed more like a feature request.
@jorisvandenbossche @coady Does one of you want to move this PR forward? |
Closing because it has been untouched for a while, in case it's still relevant feel free to reopen and move it forward 👍 |
No description provided.