vanzin commented on a change in pull request #23952: [SPARK-26929][SQL]fix
table owner use user instead of principal when create table through spark-sql
or beeline
URL: https://github.com/apache/spark/pull/23952#discussion_r323453779
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -220,7 +221,15 @@ private[hive] class HiveClientImpl(
hiveConf
}
- private val userName = conf.getUser
+ private val userName = {
+ val doAs = sys.env.get("HADOOP_USER_NAME").orNull
+ val ugi = if (doAs != null && doAs.length() > 0) {
Review comment:
Right, and there's a huge comment in the Hive method (at least in the branch
I'm looking at) that explains why that is done. And if you read that comment
you'll see that it does not apply here.
In a way, the HMS API is broken in that it lets the caller set the owner
(instead of getting it from the auth info).
But we really should at least try to get the correct information through,
and that comes from the UGI, not from env variables.
----------------------------------------------------------------
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]