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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -2056,26 +2046,26 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase {
 
   def cannotWriteTooManyColumnsToTableError(
       tableName: String,
-      expected: Seq[Attribute],
+      expected: Seq[String],
       query: LogicalPlan): Throwable = {
     new AnalysisException(
-      errorClass = "INSERT_COLUMN_ARITY_MISMATCH",
+      errorClass = "INSERT_COLUMN_ARITY_MISMATCH.TOO_MANY_DATA_COLUMNS",
       messageParameters = Map(
         "tableName" -> tableName,

Review Comment:
   Use `toSQLId`, please.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -1743,10 +1733,10 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase {
         "partColNames" -> partColNames.map(_.name).mkString(",")))
   }
 
-  def ddlWithoutHiveSupportEnabledError(detail: String): Throwable = {
+  def ddlWithoutHiveSupportEnabledError(cmd: String): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1170",
-      messageParameters = Map("detail" -> detail))
+      errorClass = "NOT_SUPPORTED_COMMAND_WITHOUT_HIVE_SUPPORT",
+      messageParameters = Map("cmd" -> cmd))

Review Comment:
   Is it a SQL statement? If so, quote it by `toSQLStmt`



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -1651,6 +1665,11 @@
     ],
     "sqlState" : "46110"
   },
+  "NOT_SUPPORTED_COMMAND_WITHOUT_HIVE_SUPPORT" : {
+    "message" : [
+      "<cmd> is not supported, if you want to enable it, please set 
`spark.sql.catalogImplementation` to `hive`."

Review Comment:
   Please, quote the SQL config and its value in the same way as `toSQLConf` 
and `toSQLConfVal`



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -877,10 +877,24 @@
   },
   "INSERT_COLUMN_ARITY_MISMATCH" : {
     "message" : [
-      "Cannot write to '<tableName>', <reason>:",
-      "Table columns: <tableColumns>.",
-      "Data columns: <dataColumns>."
+      "Cannot write to '<tableName>',"

Review Comment:
   The error message is too generic comparing to error class name. Could you 
make it more specific.
   
   Also, remove '' around table name:
   ```suggestion
         "Cannot write to <tableName>,"
   ```



-- 
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-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to