-
Notifications
You must be signed in to change notification settings - Fork 972
[KYUUBI #5492][AUTHZ] saveAsTable create DataSource table miss db info #5493
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
|
ping @bowenliang123 @yaooqinn Could you take a look |
bowenliang123
left a comment
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.
LGTM.
Codecov Report
@@ Coverage Diff @@
## master #5493 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 588 588
Lines 33480 33480
Branches 4405 4405
======================================
Misses 33480 33480 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| val e = intercept[AccessControlException] { | ||
| doAs(someone, df.write.mode("overwrite").saveAsTable(table1)) | ||
| } | ||
| assert(e.getMessage.contains(s"does not have [create] privilege on [$defaultDb/$table1]")) |
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.
Hi, you may use the interceptContains method to simplify the assertions. Very handy and clear.
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.
Hi, you may use the
interceptContainsmethod to simplify the assertions. Very handy and clear.
Done. I will refine these test's UT by interceptContains later
yaooqinn
left a comment
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.
setCurrentDatabaseIfMissing shall be used
Done |
|
Thanks, merged to master and 1.8 |
|
Hi @AngersZhuuuu, it conflicts 1.8, can you send a backport PR? |
Why are the changes needed?
To fix #5492

When we use saveAsTable and write as a DataSource table, since CreateTableAsDataSource command's catalogTable was directly constructed by identifier and only will check when executing, so here authz will miss db information as below case
This fixes this issue by following the Spark's code

How was this patch tested?
Add some test cases that check the changes thoroughly including negative and positive cases if possible
Add screenshots for manual tests if appropriate
Run test locally before make a pull request
Was this patch authored or co-authored using generative AI tooling?
No