yaooqinn commented on a change in pull request #26806: [SPARK-30183][SQL] 
Disallow to specify reserved properties in CREATE NAMESPACE syntax
URL: https://github.com/apache/spark/pull/26806#discussion_r363576960
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##########
 @@ -2525,11 +2526,17 @@ class AstBuilder(conf: SQLConf) extends 
SqlBaseBaseVisitor[AnyRef] with Logging
     var properties = ctx.tablePropertyList.asScala.headOption
       .map(visitPropertyKeyValues)
       .getOrElse(Map.empty)
-    Option(ctx.comment).map(string).map {
-      properties += SupportsNamespaces.PROP_COMMENT -> _
+
+    if (properties.keySet.exists(RESERVED_PROPERTIES.contains)) {
+      throw new ParseException(s"Disallow to specify reserved properties, 
including" +
 
 Review comment:
   we have made an undocumented breaking change here, the `comment` and 
`location` have side-effects now. Simply forbid them seems to make the 
influence smaller. Otherwise for fully backward compatibility, we shoud add 
addtional logic to let them have no side effects.
   ```sql
   create database spark2 with dbproperites ('comment'='ct', 'location'='loc');
   ```
   ```sql
   Database Name        spark2
   Description
   Location     
file:/Users/kentyao/Downloads/spark/spark-2.4.4-bin-hadoop2.7/spark-warehouse/spark2.db
   Properties   ((comment,ct), (location,loc))
   Time taken: 0.022 seconds, Fetched 4 row(s)
   ```
   ```sql
   create database spark3 with dbproperties ('comment'='ct', 'location'='loc');
   ```
   ```sql
   Database Name        spark3
   Description  ct
   Location     
file:/Users/kentyao/Downloads/spark/spark-3.0.0-SNAPSHOT-bin-20200103/loc
   Owner Name   kentyao
   Owner Type   USER
   Properties
   Time taken: 0.019 seconds, Fetched 6 row(s)
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to