[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-07-02 Thread HonglunChen (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17373428#comment-17373428
 ] 

HonglunChen commented on SPARK-34632:
-

Yes, we can do that. I just want Spark to support this by default, and it has 
no effect on Spark at all.

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-07-02 Thread dzcxzl (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17373410#comment-17373410
 ] 

dzcxzl commented on SPARK-34632:


You can use the default Authenticator to get the username through ugi.
hive.security.authenticator.manager=org.apache.hadoop.hive.ql.security.HadoopDefaultAuthenticator

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-03-07 Thread Hyukjin Kwon (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17297097#comment-17297097
 ] 

Hyukjin Kwon commented on SPARK-34632:
--

Oh, I thought you were referring Spark session. I rushed to read - there are 
classes with the exactly same names. Okay, seems making sense.

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-03-07 Thread HonglunChen (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17297067#comment-17297067
 ] 

HonglunChen commented on SPARK-34632:
-

The main purpose is to get the username from 
org.apache.hadoop.hive.ql.session.SessionState and then Hive use the username 
to do authentication. Please see 
[https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java#L49].

My use case is at the line 49 in the 
[SessionStateUserAuthenticator.java|https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java#L49].
 Now 'sessionState.getUserName()' will return null, thus Hive can not do 
authentication.

The SessionSate is created in HiveClientImpl.scala without setting up username: 
 

val state = new SessionState(hiveConf)

So, all I need is to set the current user in SessionState, which like this:

val state = new SessionState(hiveConf,username)

I don't know if you know what I mean. 

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-03-07 Thread Hyukjin Kwon (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17297064#comment-17297064
 ] 

Hyukjin Kwon commented on SPARK-34632:
--

You can configure the user name i suggested above. Please clarify your use case 
with Hive authentication.

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-03-07 Thread HonglunChen (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17297054#comment-17297054
 ] 

HonglunChen commented on SPARK-34632:
-

You don't see my point. I know the the value of username in HiveClientImpl is 
UserGroupInformation.getCurrentUser().getShortUserName(). But the 
org.apache.hadoop.hive.ql.session.SessionState does not has a default user. The 
user of SessionState can help with the hive authentication.

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-03-07 Thread Hyukjin Kwon (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17297052#comment-17297052
 ] 

Hyukjin Kwon commented on SPARK-34632:
--

Can you elaborate why is it useful? We can just keep it matched with 
{{UserGroupInformation.getCurrentUser().getShortUserName()}} or you can set an 
environment variable {{SPARK_USER}}.

Or you can also leverage {{--proxy-user}} at Spark submit option if you're on 
Yarn. 

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-03-07 Thread HonglunChen (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17297049#comment-17297049
 ] 

HonglunChen commented on SPARK-34632:
-

[~hyukjin.kwon]

We can use the username in the sessionState  to do hive authentication. Please 
see 
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java#L49

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (SPARK-34632) Can we create 'SessionState' with a username in 'HiveClientImpl'

2021-03-06 Thread Hyukjin Kwon (Jira)


[ 
https://issues.apache.org/jira/browse/SPARK-34632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17296743#comment-17296743
 ] 

Hyukjin Kwon commented on SPARK-34632:
--

It would be great if you elaborate the benefits of doing this?

> Can we create 'SessionState' with a username in 'HiveClientImpl'
> 
>
> Key: SPARK-34632
> URL: https://issues.apache.org/jira/browse/SPARK-34632
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 3.0.0
>Reporter: HonglunChen
>Priority: Minor
>
> [https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L165]
> Like this:
> val state = new SessionState(hiveConf, userName)
> We can then easily use the Hive Authorization through the user information in 
> the 'SessionState'.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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