-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28996][SQL][TESTS] Add tests regarding username of HiveClient #25696
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
|
Looks like renaming is not recognized though git status showed it correctly. (Shouldn't I reuse the name of HiveClientSuite?) I'll try to play with this if someone concerns about the excessive lines of change. |
|
Test build #110182 has finished for PR 25696 at commit
|
| @@ -0,0 +1,341 @@ | |||
| /* | |||
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.
This is just a renaming, though Github doesn't seem to recognize it.
| @@ -0,0 +1,29 @@ | |||
| /* | |||
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.
Same: This is just a renaming, though Github doesn't seem to recognize it.
|
cc. @cloud-fan @gatorsmile @dongjoon-hyun I'm also asking to review #23952 in pair, as I feel #23952 is the right way but that should have test. I'm OK to rebase this to reflect #23952 if we would like to merge #23952 before this. |
|
Test build #110215 has finished for PR 25696 at commit
|
|
shouldn't this and #23952 be put together and merged together as one PR? |
|
There're some reasons to make this be separated PR:
|
| "[email protected]", ugi, Array.empty) | ||
| proxyUgi.doAs(new PrivilegedExceptionAction[Unit]() { | ||
| override def run(): Unit = { | ||
| assert(proxyUgi.getUserName === getUserNameFromHiveClient) |
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.
This test seems wrong for that the bug is about. proxyUgi.getUserName will return [email protected], and isn't the bug about it needing to be only proxyprincipal to match Hive's behavior?
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.
Before SPARK-26929 it was "[email protected]" - as test passed. So setting HADOOP_USER_NAME and proxy user being set provided different results. I couldn't add test for HADOOP_USER_NAME as artificially setting system env. is hard.
Anyway SPARK-26929 removes the case and makes tests here failing (intended). I'll reflect the change.
0bdc71a to
dfca82b
Compare
|
Test build #110663 has finished for PR 25696 at commit
|
|
Reflected the change of SPARK-26929 and test passed. Could we have a next round of review? |
| } | ||
|
|
||
| private val userName = UserGroupInformation.getCurrentUser.getShortUserName | ||
| override val userName = UserGroupInformation.getCurrentUser.getShortUserName |
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.
Can we change user name at runtime? If we can then it should be def instead of val.
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'm not 100% sure, but we have been defining userName as val from Spark 2.2.0, starting from this commit 344f38b
Changing it to def is safer anyway (can handle both cases - whether user name is changed or not) so please let me know if we would like to make change.
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.
Btw, that would be better to be handled via separate PR if necessary, to isolate two different things "adding test" and "fixing 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.
yea, we can investigate it in a separated pr
| import org.apache.spark.util.Utils | ||
|
|
||
| class HiveClientUserNameSuite(version: String) | ||
| extends HiveVersionSuite(version) with BeforeAndAfterAll { |
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.
BeforeAndAfterAll is not used
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.
Nice finding! Updated.
|
LGTM |
|
Test build #110719 has finished for PR 25696 at commit
|
|
thanks, merging to master! |
|
Thanks all for reviewing and merging! |
What changes were proposed in this pull request?
This patch proposes to add new tests to test the username of HiveClient to prevent changing the semantic unintentionally. The owner of Hive table has been changed back-and-forth, principal -> username -> principal, and looks like the change is not intentional. (Please refer SPARK-28996 for more details.) This patch intends to prevent this.
This patch also renames previous HiveClientSuite(s) to HivePartitionFilteringSuite(s) as it was commented as TODO, as well as previous tests are too narrowed to test only partition filtering.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Newly added UTs.