Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

coady
Copy link

@coady coady commented Dec 28, 2021

No description provided.

@github-actions
Copy link

@github-actions
Copy link

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

@edponce
Copy link
Contributor

edponce commented Dec 28, 2021

LGTM! Thanks for fixing this @coady!

@pitrou
Copy link
Member

pitrou commented Dec 29, 2021

@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__'):
Copy link
Member

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)

Copy link
Author

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.

@pitrou
Copy link
Member

pitrou commented May 4, 2022

@jorisvandenbossche @coady Does one of you want to move this PR forward?

@amol-
Copy link
Contributor

amol- commented Mar 30, 2023

Closing because it has been untouched for a while, in case it's still relevant feel free to reopen and move it forward 👍

@amol- amol- closed this Mar 30, 2023
@coady coady deleted the dev branch May 29, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants