This is an automated email from the ASF dual-hosted git repository.

yangjie01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a74e5a049aa [SPARK-46621][PYTHON] Address null from 
Exception.getMessage in Py4J captured exception
5a74e5a049aa is described below

commit 5a74e5a049aa52d19e802bea84b4b898d14f3a9b
Author: Hyukjin Kwon <gurwls...@apache.org>
AuthorDate: Mon Jan 8 19:54:36 2024 +0800

    [SPARK-46621][PYTHON] Address null from Exception.getMessage in Py4J 
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 <gurwls...@apache.org>
    Signed-off-by: yangjie01 <yangji...@baidu.com>
---
 python/pyspark/errors/exceptions/captured.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/python/pyspark/errors/exceptions/captured.py 
b/python/pyspark/errors/exceptions/captured.py
index 687bdec14154..e78a7c7bce8a 100644
--- a/python/pyspark/errors/exceptions/captured.py
+++ b/python/pyspark/errors/exceptions/captured.py
@@ -59,6 +59,8 @@ class CapturedException(PySparkException):
         )
 
         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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to