-
Notifications
You must be signed in to change notification settings - Fork 665
FIX-#7616: Implement __array_function__ stub #7617
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
FIX-#7616: Implement __array_function__ stub #7617
Conversation
Signed-off-by: Jonathan Shi <[email protected]>
The result of applying the function to this dataset. By default, it will return | ||
a NumPy array. | ||
""" | ||
return self._query_compiler.do_array_function_implementation( |
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.
Out of curiosity; what would happen here if you just returned the NotImplemented sentinel? Would this be a way to avoid calling __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.
TypeError: no implementation found for 'numpy.where' on types that implement __array_function__: [<class 'modin.pandas.dataframe.DataFrame'>]
I think numpy only explicitly calls __array__
if no __array_function__
implementation is available.
…nd native Series constructor switching bugs (#3498) SNOW-2157873 occurs because upstream modin does not implement __array_function__, instead converting to numpy ndarrays via __array__ when a numpy function is called on it. The presence of the extension wrapper for __array_function__ introduced by Snowpark pandas confuses numpy dispatch, causing unexpected AttributeErrors. This is fixed upstream with modin-project/modin#7617, and will presumably become available in the next modin release. On the Snowpark side, this PR adds relevant tests, and adds a version-guarded flag to remove the extension function and push it down to the query compiler. SNOW-2173644 occurs in specific circumstances when determining switching conditions for the DataFrame constructor. Series objects are treated as dict-like, but Series.values is a property rather than a function. We thus skip over native_pd.Series objects in the dict-like check in move_to_me_cost.
What do these changes do?
Implements
__array_function__
to prevent errors when a backend implements the function as an extension method. See linked issue for details.flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
git commit -s
docs/development/architecture.rst
is up-to-date