yaooqinn commented on a change in pull request #26080: [SPARK-29425][SQL] The 
ownership of a database should be respected
URL: https://github.com/apache/spark/pull/26080#discussion_r353185129
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
 ##########
 @@ -379,22 +374,35 @@ private[hive] class HiveClientImpl(
           s"Hive ${version.fullVersion} does not support altering database 
location")
       }
     }
-    client.alterDatabase(
+    val hiveDb = toHiveDatabase(database, false)
+    client.alterDatabase(database.name, hiveDb)
+  }
+
+  private def toHiveDatabase(database: CatalogDatabase, isCreate: Boolean): 
HiveDatabase = {
+    val props = database.properties
+    val dbOwner = props.getOrElse(PROP_OWNER_NAME, if (isCreate) userName else 
null)
+    val dbOwnerType = props.getOrElse(PROP_OWNER_TYPE, "USER")
 
 Review comment:
   I have tested with hive before, we accidentally erase `ownerName` and 
`ownerType` both, but the metastore return owner with null and displayed "" in 
hive, the owner type is displayed `USER` even it has been erased.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to