-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-43082][CONNECT][PYTHON] Arrow-optimized Python UDFs in Spark Connect #40725
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
63bb36b
_create_arrow_py_udf
xinrong-meng d702b67
in Connect
xinrong-meng 01f7190
tests
xinrong-meng 0fb7712
- debug
xinrong-meng f46d006
docstrings
xinrong-meng 3abeef4
TEST
xinrong-meng f6fc6e1
TEST
xinrong-meng 63ef94e
rmv duplicate test
xinrong-meng 86938d5
tearDownClass
xinrong-meng f5aef18
rmv f from _create_arrow_py_udf
xinrong-meng f313063
UserWarning
xinrong-meng 5e78632
finally super tearDownClass
xinrong-meng ac86bf1
fallback to regular udf
xinrong-meng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
rmv f from _create_arrow_py_udf
- Loading branch information
commit f5aef182ef108f22f138a5c19690c4b10c98551d
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,19 +141,20 @@ def _create_py_udf( | |
| and not isinstance(return_type, ArrayType) | ||
| ) | ||
| if is_arrow_enabled and is_output_atomic_type and is_func_with_args: | ||
| return _create_arrow_py_udf(f, regular_udf) | ||
| return _create_arrow_py_udf(regular_udf) | ||
| else: | ||
| return regular_udf | ||
|
|
||
|
|
||
| def _create_arrow_py_udf(f, regular_udf): # type: ignore | ||
| def _create_arrow_py_udf(regular_udf): # type: ignore | ||
| """Create an Arrow-optimized Python UDF out of a regular Python UDF.""" | ||
| require_minimum_pandas_version() | ||
| require_minimum_pyarrow_version() | ||
|
|
||
| import pandas as pd | ||
| from pyspark.sql.pandas.functions import _create_pandas_udf | ||
|
|
||
| f = regular_udf.func | ||
| return_type = regular_udf.returnType | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems that the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And |
||
|
|
||
| # "result_func" ensures the result of a Python UDF to be consistent with/without Arrow | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.