[Spark] [Authz] New Authz Plan Serde Layer#3904
[Spark] [Authz] New Authz Plan Serde Layer#3904yaooqinn wants to merge 13 commits intoapache:masterfrom
Conversation
| "fieldExtractor" : "LogicalPlanQueryExtractor" | ||
| } ] | ||
| }, { | ||
| "classname" : "org.apache.spark.sql.catalyst.plans.logical.MergeIntoIcebergTable", |
There was a problem hiding this comment.
If Iceberg's command put in table_command_spec.json used by PrivilegesBuilder, how to extend this list to separate Iceberg support in a single plugin or cover more commands ?
There was a problem hiding this comment.
This PR does not cover this case completely, table_command_spec_custom.json maybe used later to support customize third-party commands
There was a problem hiding this comment.
OK. Is it posible to put table_command_spec.json in META-INF , as a sample to for followup third-party commands plugin to expose the command spec and extractor in the same way as well ?
Codecov Report
@@ Coverage Diff @@
## master #3904 +/- ##
============================================
- Coverage 51.91% 51.78% -0.13%
Complexity 13 13
============================================
Files 508 521 +13
Lines 28996 28763 -233
Branches 3982 3849 -133
============================================
- Hits 15053 14896 -157
+ Misses 12518 12501 -17
+ Partials 1425 1366 -59
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
cc @bowenliang123 @ulysses-you @pan3793 PTAL when you have time |
...yuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/Descriptor.scala
Show resolved
Hide resolved
| val functionExtractor = functionExtractors(fieldExtractor) | ||
| var function = functionExtractor(functionVal) | ||
| if (function.database.isEmpty) { | ||
| function = function.copy(database = databaseDesc.map(_.getValue(v))) |
There was a problem hiding this comment.
why TableDesc. getValue does not need fill database ?
There was a problem hiding this comment.
I think TableDesc.getValue is filling database of Table in TableExtractor, and the database is part of the identifier for resolved table. For functions, the database is missing in some case and we are trying to get database from databaseDesc.
...rk-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/JsonSpecFileGenerator.scala
Outdated
Show resolved
Hide resolved
|
+1, LGTM. And thanks for the effort. Impressively passed the all the existed auth test in CI with in several commits. It's a great work for redesigning and modernizing Authz core implementation. It significantly improves the pattern and clearification in rule authentication by components in layers of specs, descriptors, and extractors. The idea and implemented components in resource privilege checking can be also applied to row filtering, column masking, object filtering, and even to other fields like lineage. |
|
fyi @jeanlyn |
|
late lgtm |
Why are the changes needed?
This PR redesigned the authorization part of the spark authz module with a New Authz Plan Serde Layer.
Motivation
Data structure
Overall, we introduce 2 general basic data structures:
classnameas key for the read-side to get the spec by a particular commandfieldName: the object to getfieldExtractor: the method to get the object; use SPI to loadSPI
fieldExtractorCode Path
TODOs
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