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

yao 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 c6e864538e2d [SPARK-52721][PYTHON] Fix message parameter for 
CANNOT_PARSE_DATATYPE
c6e864538e2d is described below

commit c6e864538e2d8e3c816ba0f0a7bb9e212adc0a9d
Author: Kent Yao <y...@apache.org>
AuthorDate: Wed Jul 9 17:39:42 2025 +0800

    [SPARK-52721][PYTHON] Fix message parameter for CANNOT_PARSE_DATATYPE
    
    ### What changes were proposed in this pull request?
    
    Fix message parameter for CANNOT_PARSE_DATATYPE
    
    ### Why are the changes needed?
    bugfix
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    
    - Before
    AssertionError: Undefined error message parameter for error class: 
CANNOT_PARSE_DATATYPE. Parameters: {'error':
    
    - After
    pyspark.errors.exceptions.base.PySparkValueError: [CANNOT_PARSE_DATATYPE] 
Unable to parse datatype.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #51414 from yaooqinn/SPARK-52721.
    
    Authored-by: Kent Yao <y...@apache.org>
    Signed-off-by: Kent Yao <y...@apache.org>
---
 python/pyspark/sql/classic/dataframe.py | 2 +-
 python/pyspark/sql/types.py             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/pyspark/sql/classic/dataframe.py 
b/python/pyspark/sql/classic/dataframe.py
index f72c066a6572..722f0615b370 100644
--- a/python/pyspark/sql/classic/dataframe.py
+++ b/python/pyspark/sql/classic/dataframe.py
@@ -207,7 +207,7 @@ class DataFrame(ParentDataFrame, PandasMapOpsMixin, 
PandasConversionMixin):
         except Exception as e:
             raise PySparkValueError(
                 errorClass="CANNOT_PARSE_DATATYPE",
-                messageParameters={"error": str(e)},
+                messageParameters={"msg": str(e)},
             )
 
     def printSchema(self, level: Optional[int] = None) -> None:
diff --git a/python/pyspark/sql/types.py b/python/pyspark/sql/types.py
index 6ff6d78a94c5..744815b751ed 100644
--- a/python/pyspark/sql/types.py
+++ b/python/pyspark/sql/types.py
@@ -2012,7 +2012,7 @@ def _parse_datatype_json_value(
         else:
             raise PySparkValueError(
                 errorClass="CANNOT_PARSE_DATATYPE",
-                messageParameters={"error": str(json_value)},
+                messageParameters={"msg": str(json_value)},
             )
     else:
         tpe = json_value["type"]


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

Reply via email to