Uh oh!
There was an error while loading. Please reload this page.
[SPARK-19970][SQL] Table owner should be USER instead of PRINCIPAL in kerberized clusters - #17311
[SPARK-19970][SQL] Table owner should be USER instead of PRINCIPAL in kerberized clusters#17311dongjoon-hyun wants to merge 5 commits into
Conversation
… kerberized clusters
dongjoon-hyun
commented
Mar 16, 2017
Hi, @vanzin . |
SparkQA
commented
Mar 16, 2017
Test build #74657 has finished for PR 17311 at commit
|
dongjoon-hyun
commented
Mar 16, 2017
Oh, there exists a version issue. Let me fix that. |
| } | ||
| hiveTable.setPartCols(partCols.asJava) | ||
| conf.foreach(c => hiveTable.setOwner(c.getUser)) | ||
| conf.foreach(c => hiveTable.setOwner(SessionState.getUserFromAuthenticator())) |
There was a problem hiding this comment.
getUserFromAuthenticator was added 0.13.
SparkQA
commented
Mar 16, 2017
Test build #74664 has finished for PR 17311 at commit
|
| } | ||
| hiveTable.setPartCols(partCols.asJava) | ||
| conf.foreach(c => hiveTable.setOwner(c.getUser)) | ||
| conf.foreach(c => hiveTable.setOwner(SessionState.get().getAuthenticator().getUserName())) |
There was a problem hiding this comment.
We cannot use the following since it was introduced in 0.13.
conf.foreach(c => hiveTable.setOwner(SessionState.getUserFromAuthenticator()))
There was a problem hiding this comment.
Since you're touching this, could you make it follow the usual style?
.foreach { c => ... }
There was a problem hiding this comment.
Thank you for review, @vanzin !
Which object do you mean for .foreach here?
For conf, we already use that.
For SessionState.get(), it's not Option.
There was a problem hiding this comment.
There's only one foreach call and it's using a different style than the rest of the code.
There was a problem hiding this comment.
Oh, I see. It's about removing .foreach.
There was a problem hiding this comment.
No, it's about style. Parentheses v. braces.
dongjoon-hyun
commented
Mar 17, 2017
Hi, @gatorsmile . |
dongjoon-hyun
commented
Mar 17, 2017
I fixed that, @vanzin . Thank you again. |
| } | ||
| hiveTable.setPartCols(partCols.asJava) | ||
| conf.foreach(c => hiveTable.setOwner(c.getUser)) | ||
| conf.foreach { _ => hiveTable.setOwner(SessionState.get().getAuthenticator().getUserName()) } |
There was a problem hiding this comment.
Oh, I think we can remove conf here.
There was a problem hiding this comment.
Ah, yes, you're not using it anymore. So away it goes.
There was a problem hiding this comment.
@vanzin . Some test cases seems to related with conf is None, it causes failures. In this PR, I'll focus on putting the correct name only with the exactly same situations of the previous existing logic.
There was a problem hiding this comment.
I think we should pass the user name.
SparkQA
commented
Mar 17, 2017
Test build #74750 has finished for PR 17311 at commit
|
SparkQA
commented
Mar 17, 2017
Test build #74748 has finished for PR 17311 at commit
|
This reverts commit 5efdf8b.
SparkQA
commented
Mar 17, 2017
Test build #74753 has finished for PR 17311 at commit
|
dongjoon-hyun
commented
Mar 18, 2017
If there is anything to do more, please let me know. |
dongjoon-hyun
commented
Mar 18, 2017
dongjoon-hyun
commented
Mar 20, 2017
Retest this please |
SparkQA
commented
Mar 20, 2017
Test build #74877 has finished for PR 17311 at commit
|
| } | ||
| hiveTable.setPartCols(partCols.asJava) | ||
| conf.foreach(c => hiveTable.setOwner(c.getUser)) | ||
| conf.foreach { _ => hiveTable.setOwner(SessionState.get().getAuthenticator().getUserName()) } |
There was a problem hiding this comment.
Shouldn't you be using the state field in the class instead of SessionState.get()? Maybe that will allow you to get rid of the foreach.
There was a problem hiding this comment.
state is in class HiveClientImpl, but this function is in object HiveClientImpl.
There was a problem hiding this comment.
Ahh. Now it makes sense why conf would be None.
vanzin
commented
Mar 20, 2017
LGTM, merging to master / 2.1. |
dongjoon-hyun
commented
Mar 20, 2017
Thank you so much, @vanzin ! |
vanzin
commented
Mar 20, 2017
Couldn't merge to 2.1. |
dongjoon-hyun
commented
Mar 20, 2017
Oh, I'll make a backport then. |
dongjoon-hyun
commented
Mar 20, 2017
The difference is due to 3881f34#diff-6fd847124f8eae45ba2de1cf7d6296feR855 . |
…RINCIPAL in kerberized clusters apache#17311 ### What changes were proposed in this pull request? This is a follow-up for the PR: apache#17311 - For safety, use `sessionState` to get the user name, instead of calling `SessionState.get()` in the function `toHiveTable`. - Passing `user names` instead of `conf` when calling `toHiveTable`. ### How was this patch tested? N/A Author: Xiao Li <gatorsmile@gmail.com> Closesapache#17405 from gatorsmile/user.
What changes were proposed in this pull request?
In the kerberized hadoop cluster, when Spark creates tables, the owner of tables are filled with PRINCIPAL strings instead of USER names. This is inconsistent with Hive and causes problems when using ROLE in Hive. We had better to fix this.
BEFORE
AFTER
How was this patch tested?
Manually do
create tableanddesc formattedbecause this happens in Kerberized clusters.