[SPARK-45746][Python] Return specific error messages if UDTF 'analyze' or 'eval' method accepts or returns wrong values#43611
Closed
dtenedor wants to merge 16 commits intoapache:masterfrom
Closed
Conversation
Contributor
Author
|
cc @ueshin |
Contributor
Author
|
cc @ueshin the failing tests look unrelated |
ueshin
reviewed
Nov 10, 2023
fetch from master
respond to code review comments reformat python
ueshin
reviewed
Nov 18, 2023
Member
Contributor
Author
|
Hi @allisonwang-db, responded to your code review comments, please take another look. |
ueshin
approved these changes
Nov 28, 2023
| handler = read_udtf(infile) | ||
| args, kwargs = read_arguments(infile) | ||
|
|
||
| error_prefix = f"Failed to evaluate the user-defined table function '{handler.__name__}'" |
Member
There was a problem hiding this comment.
This handler.__name__ should also be used the registered name?
Contributor
Author
There was a problem hiding this comment.
Good suggestion, done!
Member
|
The failed tests seem not related to this PR. |
Member
|
Thanks! merging to master. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
This PR adds checks to return specific error messages if any Python UDTF
analyzeorevalmethod accepts or returns wrong values.Error messages improved include:
__init__method takes more arguments thanselfandanalyze_result.analyzeorevalexpects (not using*argsor**kwargs).analyzemethod returns an object besides aStructTypein theAnalyzeResultschemafield.AnalyzeResultfields relating to input table arguments (e.g.with_single_partition) but theanalyzemethod received no input table argument.analyzemethod tries to return a list of strings for thepartition_byoptional field of theAnalyzeResultinstead of a list ofPartitioningColumnobjects.AnalyzeResultis missing theschemaargument entirely.analyzeorevalmethod does not accept arguments with those keyword(s) (or**kwargs).Why are the changes needed?
This helps users understand how to easily fix their user-defined table functions if they are malformed.
Does this PR introduce any user-facing change?
Yes, see above.
How was this patch tested?
This PR adds test coverage.
Was this patch authored or co-authored using generative AI tooling?
No.