Skip to content

Commit

Permalink
[SPARK-46621][PYTHON] Address null from Exception.getMessage in Py4J …
Browse files Browse the repository at this point in the history
…captured exception

### What changes were proposed in this pull request?

This PR proposes to address null from `Exception.getMessage` in Py4J captured exception. It returns an empty string.

### Why are the changes needed?

So whitelisted exceptions with an empty arguments are also covered.

### Does this PR introduce _any_ user-facing change?

Virtually no. It only happens when whitelisted exceptions are created without any argument so `null` is located in `message`.

### How was this patch tested?

Manually.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #44623 from HyukjinKwon/SPARK-46621.

Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: yangjie01 <yangjie01@baidu.com>
  • Loading branch information
HyukjinKwon authored and LuciferYang committed Jan 8, 2024
1 parent db4ad6b commit 5a74e5a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/pyspark/errors/exceptions/captured.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def __init__(
)

self._desc = desc if desc is not None else cast(Py4JJavaError, origin).getMessage()
if self._desc is None:
self._desc = ""
assert SparkContext._jvm is not None
self._stackTrace = (
stackTrace
Expand Down

0 comments on commit 5a74e5a

Please sign in to comment.