You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/09 12:50:52 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #38954: [SPARK-41417][CORE][SQL] Rename `_LEGACY_ERROR_TEMP_0019` to `CANNOT_PARSE_VALUE_TO_DATATYPE`

MaxGekk commented on code in PR #38954:
URL: https://github.com/apache/spark/pull/38954#discussion_r1044416555


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala:
##########
@@ -211,7 +211,7 @@ private[sql] object QueryParsingErrors extends QueryErrorsBase {
   def cannotParseValueTypeError(
       valueType: String, value: String, ctx: TypeConstructorContext): Throwable = {
     new ParseException(
-      errorClass = "_LEGACY_ERROR_TEMP_0019",
+      errorClass = "CANNOT_PARSE_VALUE_TO_DATATYPE",
       messageParameters = Map("valueType" -> valueType, "value" -> value),

Review Comment:
   Please, quote `value` as a string using `toSQLValue()`, and `valueType` by default (can use `toSQLType()`).



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -80,6 +80,12 @@
     ],
     "sqlState" : "42000"
   },
+  "CANNOT_PARSE_VALUE_TO_DATATYPE" : {

Review Comment:
   Let's make it shorter: `INVALID_TYPED_LITERAL` taking into account that there is `UNSUPPORTED_TYPED_LITERAL` already.



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -80,6 +80,12 @@
     ],
     "sqlState" : "42000"
   },
+  "CANNOT_PARSE_VALUE_TO_DATATYPE" : {
+    "message" : [
+      "Cannot parse <value> to <valueType> type."

Review Comment:
   `The value of the typed literal <valueType> is invalid: <value>.`
   
   If `valueType` is `X`, the message might confuse since there is no type `X`.



-- 
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