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/04/14 12:48:21 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #36163: [SPARK-38689][SQL] Use error classes in the compilation errors of not allowed DESC PARTITION on views

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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -1930,11 +1930,15 @@ object QueryCompilationErrors {
   }
 
   def descPartitionNotAllowedOnTempView(table: String): Throwable = {
-    new AnalysisException(s"DESC PARTITION is not allowed on a temporary view: $table")
+    new AnalysisException(
+      errorClass = "INVALID_OPERATION_ON_TEMP_VIEW",
+      messageParameters = Array(toSQLValue("DESC PARTITION"), toSQLValue(table)))
   }
 
   def descPartitionNotAllowedOnView(table: String): Throwable = {
-    new AnalysisException(s"DESC PARTITION is not allowed on a view: $table")
+    new AnalysisException(
+      errorClass = "INVALID_OPERATION_ON_VIEW",
+      messageParameters = Array(toSQLValue("DESC PARTITION"), toSQLValue(table)))

Review Comment:
   Precisely speaking,  `DESC PARTITION` is not a value. Actually, it is a part of sql statement. Could you add a method `toSQLStmt` and invoke it here. We will call it for quoting of sql statements in error messages. 



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