-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-19970][SQL] Table owner should be USER instead of PRINCIPAL in kerberized clusters #17311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… kerberized clusters
|
Hi, @vanzin . |
|
Test build #74657 has finished for PR 17311 at commit
|
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getUserFromAuthenticator was added 0.13.
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're touching this, could you make it follow the usual style?
.foreach { c => ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. It's about removing .foreach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's about style. Parentheses v. braces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Sorry again.
|
Hi, @gatorsmile . |
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think we can remove conf here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, you're not using it anymore. So away it goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should pass the user name.
|
Test build #74750 has finished for PR 17311 at commit
|
|
Test build #74748 has finished for PR 17311 at commit
|
This reverts commit 5efdf8b.
|
Test build #74753 has finished for PR 17311 at commit
|
|
If there is anything to do more, please let me know. |
|
Retest this please |
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state is in class HiveClientImpl, but this function is in object HiveClientImpl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. Now it makes sense why conf would be None.
|
LGTM, merging to master / 2.1. |
|
Thank you so much, @vanzin ! |
|
Couldn't merge to 2.1. |
|
Oh, I'll make a backport then. |
|
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> Closes apache#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.