-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23754][Python] Re-raising StopIteration in client code #21383
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
Changes from 1 commit
ec7854a
fddd031
ee54924
d739eea
f0f80ed
d59f0d5
b0af18e
167a75b
90b064d
75316af
026ecdd
f7b53c2
8fac2a8
5b5570b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ | |
| from pyspark.sql.column import Column, _to_java_column, _to_seq | ||
| from pyspark.sql.types import StringType, DataType, StructType, _parse_datatype_string,\ | ||
| to_arrow_type, to_arrow_schema | ||
| from pyspark.util import _get_argspec | ||
| from pyspark.util import _get_argspec, fail_on_stopiteration | ||
|
|
||
| __all__ = ["UDFRegistration"] | ||
|
|
||
|
|
@@ -92,7 +92,7 @@ def __init__(self, func, | |
| raise TypeError( | ||
| "Invalid evalType: evalType should be an int but is {}".format(evalType)) | ||
|
|
||
| self.func = func | ||
| self.func = fail_on_stopiteration(func) | ||
|
||
| self._returnType = returnType | ||
| # Stores UserDefinedPythonFunctions jobj, once initialized | ||
| self._returnType_placeholder = None | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,8 +91,8 @@ def majorMinorVersion(sparkVersion): | |
|
|
||
| def fail_on_stopiteration(f): | ||
| """ | ||
| Wraps the input function to fail on 'StopIteration' by raising a 'RuntimeError' | ||
| prevents silent loss of data when 'f' is used in a for loop | ||
| Wraps the input function to fail on 'StopIteration' by raising a 'RuntimeError' | ||
| prevents silent loss of data when 'f' is used in a for loop | ||
| """ | ||
|
Member
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. per PEP 8 |
||
| def wrapper(*args, **kwargs): | ||
| try: | ||
|
|
||
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.
Can we check for error message here?