[ 
https://issues.apache.org/jira/browse/SPARK-26929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dongjoon Hyun updated SPARK-26929:
----------------------------------
    Description: 
In kerberos cluster, when use spark-sql or beeline to create table,  the owner 
will be whole info of principal. the _issue_  was fixed in SPARK-19970 and 
modify by SPARK-22846, so it occur again. It will causes some problems when 
using role., and this time should resolved two issues together.

Use  org.apache.hadoop.hive.shims.Utils.getUGI  directly to get 
ugi.getShortUserName

instead of use  conf.getUser which return principal info.

Code change
{code:java}
private val userName: String = try {
val ugi = HiveUtils.getUGI
ugi.getShortUserName
} catch {
case e: LoginException => throw new IOException(e)
}
{code}
Berfore

{code}
scala> sql("create table t(a int)").show
 scala> sql("desc formatted t").show(false)
 ...
|Owner:|sp...@example.com| |
{code}

After:

{code}
 scala> sql("create table t(a int)").show
 scala> sql("desc formatted t").show(false)
 ...
|Owner:|spark| |
{code}


  was:
In kerberos cluster, when use spark-sql or beeline to create table,  the owner 
will be whole info of principal. the _issue_  has occur in SPARK-19970 and 
modify by SPARK-22846, so it occur again. It will causes some problems when 
using role., and this time should resolved two issues together.

Use  org.apache.hadoop.hive.shims.Utils.getUGI  directly to get 
ugi.getShortUserName

instead of use  conf.getUser which return principal info.

Code change
{code:java}
private val userName: String = try {
val ugi = HiveUtils.getUGI
ugi.getShortUserName
} catch {
case e: LoginException => throw new IOException(e)
}
{code}
Berfore

{code}
scala> sql("create table t(a int)").show
 scala> sql("desc formatted t").show(false)
 ...
|Owner:|sp...@example.com| |
{code}

After:

{code}
 scala> sql("create table t(a int)").show
 scala> sql("desc formatted t").show(false)
 ...
|Owner:|spark| |
{code}



> table owner should use user instead of principal when use kerberos
> ------------------------------------------------------------------
>
>                 Key: SPARK-26929
>                 URL: https://issues.apache.org/jira/browse/SPARK-26929
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0
>            Reporter: hong dongdong
>            Priority: Major
>
> In kerberos cluster, when use spark-sql or beeline to create table,  the 
> owner will be whole info of principal. the _issue_  was fixed in SPARK-19970 
> and modify by SPARK-22846, so it occur again. It will causes some problems 
> when using role., and this time should resolved two issues together.
> Use  org.apache.hadoop.hive.shims.Utils.getUGI  directly to get 
> ugi.getShortUserName
> instead of use  conf.getUser which return principal info.
> Code change
> {code:java}
> private val userName: String = try {
> val ugi = HiveUtils.getUGI
> ugi.getShortUserName
> } catch {
> case e: LoginException => throw new IOException(e)
> }
> {code}
> Berfore
> {code}
> scala> sql("create table t(a int)").show
>  scala> sql("desc formatted t").show(false)
>  ...
> |Owner:|sp...@example.com| |
> {code}
> After:
> {code}
>  scala> sql("create table t(a int)").show
>  scala> sql("desc formatted t").show(false)
>  ...
> |Owner:|spark| |
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to