You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "allisonwang-db (via GitHub)" <gi...@apache.org> on 2023/04/26 12:04:48 UTC
[GitHub] [spark] allisonwang-db commented on a diff in pull request #40926: [SPARK-43261][PYTHON] Migrate `TypeError` from Spark SQL types into error class.
allisonwang-db commented on code in PR #40926:
URL: https://github.com/apache/spark/pull/40926#discussion_r1177769747
##########
python/pyspark/errors/error_classes.py:
##########
@@ -64,6 +69,11 @@
"Argument `<arg_name>` can not be None."
]
},
+ "CANNOT_CONVERT": {
Review Comment:
Maybe `CANNOT_CONVERT_TYPE`
##########
python/pyspark/errors/error_classes.py:
##########
@@ -74,6 +84,21 @@
"Can not infer Array Type from an list with None as the first element."
]
},
+ "CANNOT_INFER_SCHEMA_FOR_TYPE": {
+ "message": [
+ "Can not infer schema for type: `<data_type>`."
Review Comment:
Do we need to wrap any data_type reference in ``?
##########
python/pyspark/sql/types.py:
##########
@@ -2183,7 +2216,13 @@ def asDict(self, recursive: bool = False) -> Dict[str, Any]:
True
"""
if not hasattr(self, "__fields__"):
- raise TypeError("Cannot convert a Row class into dict")
+ raise PySparkTypeError(
+ error_class="CANNOT_CONVERT",
+ message_parameters={
+ "from_type": "Row",
Review Comment:
Here should be `a Row class`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org