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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala:
##########
@@ -267,16 +267,26 @@ object QueryParsingErrors extends QueryErrorsBase {
 
   def cannotCleanReservedNamespacePropertyError(
       property: String, ctx: ParserRuleContext, msg: String): Throwable = {
-    new ParseException(s"$property is a reserved namespace property, $msg.", 
ctx)
+    new ParseException(
+      errorClass = "UNSUPPORTED_FEATURE",
+      messageParameters = Array("CLEAN_RESERVED_NAMESPACE_PROPERTY", 
s"$property", s"$msg"),

Review Comment:
   ```suggestion
         messageParameters = Array("CLEAN_RESERVED_NAMESPACE_PROPERTY", 
property, msg),
   ```



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala:
##########
@@ -267,16 +267,26 @@ object QueryParsingErrors extends QueryErrorsBase {
 
   def cannotCleanReservedNamespacePropertyError(
       property: String, ctx: ParserRuleContext, msg: String): Throwable = {
-    new ParseException(s"$property is a reserved namespace property, $msg.", 
ctx)
+    new ParseException(
+      errorClass = "UNSUPPORTED_FEATURE",
+      messageParameters = Array("CLEAN_RESERVED_NAMESPACE_PROPERTY", 
s"$property", s"$msg"),
+      ctx)
   }
 
   def propertiesAndDbPropertiesBothSpecifiedError(ctx: 
CreateNamespaceContext): Throwable = {
-    new ParseException("Either PROPERTIES or DBPROPERTIES is allowed.", ctx)
+    new ParseException(
+      errorClass = "UNSUPPORTED_FEATURE",
+      messageParameters = 
Array("PROPERTIES_AND_DBPROPERTIES_BOTH_SPECIFIED_CONFLICT"),
+      ctx
+    )
   }
 
   def cannotCleanReservedTablePropertyError(
       property: String, ctx: ParserRuleContext, msg: String): Throwable = {
-    new ParseException(s"$property is a reserved table property, $msg.", ctx)
+    new ParseException(
+      errorClass = "UNSUPPORTED_FEATURE",
+      messageParameters = Array("CLEAN_RESERVED_TABLE_PROPERTY", s"$property", 
s"$msg"),

Review Comment:
   ```suggestion
         messageParameters = Array("CLEAN_RESERVED_TABLE_PROPERTY", property, 
msg),
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryParsingErrorsSuite.scala:
##########
@@ -642,4 +642,92 @@ class QueryParsingErrorsSuite extends QueryTest with 
QueryErrorsSuiteBase {
           |^^^
           |""".stripMargin)
   }
+
+  test("UNSUPPORTED_FEATURE: cannot clean reserved namespace property") {
+    val sql = "CREATE NAMESPACE IF NOT EXISTS a.b.c WITH PROPERTIES 
('location'='/home/user/db')"
+    validateParsingError(
+      sqlText = sql,
+      errorClass = "UNSUPPORTED_FEATURE",
+      errorSubClass = Some("CLEAN_RESERVED_NAMESPACE_PROPERTY"),

Review Comment:
   I guess, the name of the error class might confuse users. Could you make it 
simpler CLEAN_RESERVED_NAMESPACE_PROPERTY -> SET_NAMESPACE_PROPERTY. So users 
should see:
   ```
   [UNSUPPORTED_FEATURE.SET_NAMESPACE_PROPERTY]
   ```



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