HeartSaVioR 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_r322494741
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -220,7 +222,17 @@ private[hive] class HiveClientImpl(
hiveConf
}
- private val userName = conf.getUser
+ private val userName = try {
+ val doAs = sys.env.get("HADOOP_USER_NAME").orNull
+ val ugi = if (doAs != null && doAs.length() > 0) {
+ UserGroupInformation.createProxyUser(doAs,
UserGroupInformation.getLoginUser())
+ } else {
+ UserGroupInformation.getCurrentUser
+ }
+ ugi.getShortUserName
+ } catch {
+ case _: LoginException => throw new LoginException("Can not get login
user.")
Review comment:
According to the previous comment, I guess the origin code was `IOException`
wrapped `LoginException`:
https://github.com/apache/spark/pull/23952/files#r268466632
so if we want to follow the origin code, use IOException, otherwise, just
remove try/catch.
----------------------------------------------------------------
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]