-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KYUUBI #5780][AUTHZ] Treating PermanentViewMarker as LeafNode make c…
…ode simple and got correct privilege object # 🔍 Description ## Issue References 🔗 This pull request fixes #5780 ## Describe Your Solution 🔧 Currently, we convert persist view to PermanentViewMaker, but after optimizer, it changed its child, making it hard to do column prune and get the right column privilege object of persist view. In this pr, we change PVM as a LeafNode, then we can directly treat it as a `HiveRelation` since we won't change its internal plan to make code simpler. But we need to re-optimize the child plan after do privilege check. ## Types of changes 🔖 - [x] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan 🧪 #### Behavior Without This Pull Request ⚰️ For sql such as below table and view ``` CREATE TABLE IF NOT EXISTS $db1.$table1(id int, scope int); CREATE TABLE IF NOT EXISTS $db1.$table2( id int, name string, age int, scope int) .stripMargin); CREATE VIEW $db1.$view1 AS WITH temp AS ( SELECT max(scope) max_scope FROM $db1.$table1) SELECT id, name, max(scope) as max_scope, sum(age) sum_age FROM $db1.$table2 WHERE scope in (SELECT max_scope FROM temp) GROUP BY id, name ``` When we execute query on `$db1.$view1` ``` SELECT id as new_id, name, max_scope FROM $db1.$view1 ``` It will first execute the subquery in the query, then got a un-correct column privilege #### Behavior With This Pull Request 🎉 After this change, since PVM is a LeafNode, we won't execute the subquery under PVM, and we directly got the correct column privilege. #### Related Unit Tests Existed UT --- # Checklists ## 📝 Author Self Checklist - [x] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project - [x] I have performed a self-review - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) ## 📝 Committer Pre-Merge Checklist - [x] Pull request title is okay. - [x] No license issues. - [x] Milestone correctly set? - [x] Test coverage is ok - [x] Assignees are selected. - [x] Minimum number of approvals - [x] No changes are requested **Be nice. Be informative.** Closes #5781 from AngersZhuuuu/KYUUBI-5780. Closes #5780 3c18bb7 [Angerszhuuuu] Merge branch 'master' into KYUUBI-5780 64f7947 [Angerszhuuuu] update b4f6fc0 [Angerszhuuuu] Merge branch 'master' into KYUUBI-5780 fbc989a [Angerszhuuuu] Update Authorization.scala 2113cf5 [Angerszhuuuu] Update RuleApplyPermanentViewMarker.scala 5dbe232 [Angerszhuuuu] Update WithInternalChildren.scala 04a40c3 [Angerszhuuuu] update 57bf5ba [Angerszhuuuu] update 738d506 [Angerszhuuuu] Update RuleApplyPermanentViewMarker.scala bade427 [Angerszhuuuu] [KYUUBI #5780][AUTHZ] Kyuubi tread PVM ass LeafNode to make logic more simple Authored-by: Angerszhuuuu <[email protected]> Signed-off-by: Kent Yao <[email protected]>
- Loading branch information
1 parent
eb9e88b
commit c1685c6
Showing
11 changed files
with
31 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,4 +215,4 @@ | |
} ], | ||
"opType" : "SWITCHDATABASE", | ||
"uriDescs" : [ ] | ||
} ] | ||
} ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,4 +111,4 @@ | |
"comment" : "" | ||
} ], | ||
"opType" : "RELOADFUNCTION" | ||
} ] | ||
} ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,4 +111,4 @@ | |
"comment" : "" | ||
} ], | ||
"uriDescs" : [ ] | ||
} ] | ||
} ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2528,4 +2528,4 @@ | |
"isInput" : false, | ||
"comment" : "Delta" | ||
} ] | ||
} ] | ||
} ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters