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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -339,10 +339,11 @@ private[sql] object QueryExecutionErrors extends 
QueryErrorsBase {
         "type" ->  toSQLType(dataType)))
   }
 
-  def noDefaultForDataTypeError(dataType: DataType): SparkRuntimeException = {
-    new SparkRuntimeException(
-      errorClass = "_LEGACY_ERROR_TEMP_2004",
+  def noDefaultForDataTypeError(dataType: DataType): SparkException = {
+    val errorMessage = SparkThrowableHelper.getMessage(
+      errorClass = "NO_DEFAULT_FOR_DATA_TYPE",
       messageParameters = Map("dataType" -> dataType.toString()))

Review Comment:
   Could you wrap `dataType` by `toSQLType()`, please.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -339,10 +339,11 @@ private[sql] object QueryExecutionErrors extends 
QueryErrorsBase {
         "type" ->  toSQLType(dataType)))
   }
 
-  def noDefaultForDataTypeError(dataType: DataType): SparkRuntimeException = {
-    new SparkRuntimeException(
-      errorClass = "_LEGACY_ERROR_TEMP_2004",
+  def noDefaultForDataTypeError(dataType: DataType): SparkException = {
+    val errorMessage = SparkThrowableHelper.getMessage(

Review Comment:
   Just form the error message directly from `"No default value for type: 
<dataType>."` using interpolation.



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -1190,6 +1190,11 @@
     },
     "sqlState" : "42000"
   },
+  "NO_DEFAULT_FOR_DATA_TYPE" : {

Review Comment:
   Please, remove the error class. We introduce error classes only for 
user-facing errors.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to