yaooqinn commented on a change in pull request #26775: [SPARK-30018][SQL] 
Support ALTER DATABASE SET OWNER syntax
URL: https://github.com/apache/spark/pull/26775#discussion_r364632556
 
 

 ##########
 File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
 ##########
 @@ -388,20 +391,29 @@ class HiveCatalogedDDLSuite extends DDLSuite with 
TestHiveSingleton with BeforeA
       val db1 = "spark_29425_1"
       val db2 = "spark_29425_2"
       val owner = "spark_29425"
+      val currentUser = Utils.getCurrentUserName()
 
       sql(s"CREATE DATABASE $db1")
-      checkOwner(db1, Utils.getCurrentUserName())
+      checkOwner(db1, currentUser, "USER")
       sql(s"ALTER DATABASE $db1 SET DBPROPERTIES ('a'='a')")
-      checkOwner(db1, Utils.getCurrentUserName())
-
-      // TODO: Specify ownership should be forbidden after we implement `SET 
OWNER` syntax
-      sql(s"CREATE DATABASE $db2 WITH DBPROPERTIES('ownerName'='$owner')")
-      checkOwner(db2, owner)
-      sql(s"ALTER DATABASE $db2 SET DBPROPERTIES ('a'='a')")
-      checkOwner(db2, owner)
-      // TODO: Changing ownership should be forbidden after we implement `SET 
OWNER` syntax
-      sql(s"ALTER DATABASE $db2 SET DBPROPERTIES ('ownerName'='a')")
-      checkOwner(db2, "a")
+      checkOwner(db1, currentUser, "USER")
+      val e = intercept[AnalysisException](sql(s"ALTER DATABASE $db1 SET 
DBPROPERTIES ('a'='a',"
+        + s"'ownerName'='$owner','ownerType'='XXX')"))
 
 Review comment:
   ```
   spark-sql> desc namespace extended abcde;
   20/01/09 17:24:14 INFO HiveMetaStore: 0: get_database: abcde
   20/01/09 17:24:14 INFO audit: ugi=kentyao    ip=unknown-ip-addr      
cmd=get_database: abcde
   20/01/09 17:24:14 INFO HiveMetaStore: 0: get_database: abcde
   20/01/09 17:24:14 INFO audit: ugi=kentyao    ip=unknown-ip-addr      
cmd=get_database: abcde
   Database Name        abcde
   Description
   Location     
file:/Users/kentyao/Downloads/spark/spark-3.0.0-SNAPSHOT-bin-20200103/spark-warehouse/abcde.db
   Owner Name   kentyao
   Owner Type   USER
   Properties   ((LOCATION,b))
   Time taken: 0.048 seconds, Fetched 6 row(s)
   20/01/09 17:24:14 INFO SparkSQLCLIDriver: Time taken: 0.048 seconds, Fetched 
6 row(s)
   spark-sql> desc namespace extended abcdef;
   20/01/09 17:24:21 INFO HiveMetaStore: 0: get_database: abcdef
   20/01/09 17:24:21 INFO audit: ugi=kentyao    ip=unknown-ip-addr      
cmd=get_database: abcdef
   20/01/09 17:24:21 INFO HiveMetaStore: 0: get_database: abcdef
   20/01/09 17:24:21 INFO audit: ugi=kentyao    ip=unknown-ip-addr      
cmd=get_database: abcdef
   Database Name        abcdef
   Description
   Location     
file:/Users/kentyao/Downloads/spark/spark-3.0.0-SNAPSHOT-bin-20200103/b
   Owner Name   kentyao
   Owner Type   USER
   Properties
   Time taken: 0.016 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