This is an automated email from the ASF dual-hosted git repository.
yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new fdcb4568c [KYUUBI #5735][AUTHZ] Support vacuum path-based table for
Delta Lake
fdcb4568c is described below
commit fdcb4568c41e700877d097395a2d3dc6fe710a83
Author: zml1206 <[email protected]>
AuthorDate: Thu Nov 23 09:55:17 2023 +0800
[KYUUBI #5735][AUTHZ] Support vacuum path-based table for Delta Lake
# :mag: Description
## Issue References ๐
This pull request fixes #5735.
## Describe Your Solution ๐ง
VacuumTableCommand add uriDescs.
## Types of changes :bookmark:
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] 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 :coffin:
#### Behavior With This Pull Request :tada:
#### Related Unit Tests
org.apache.kyuubi.plugin.spark.authz.ranger.DeltaCatalogRangerSparkExtensionSuite.test("vacuum
path-based table")
---
# 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
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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
- [ ] 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
- [ ] Pull request title is okay.
- [ ] No license issues.
- [ ] Milestone correctly set?
- [ ] Test coverage is ok
- [ ] Assignees are selected.
- [ ] Minimum number of approvals
- [ ] No changes are requested
**Be nice. Be informative.**
Closes #5751 from zml1206/KYUUBI-5735.
Closes #5735
463c01b47 [zml1206] Support vacuum path-based table for Delta Lake in Authz
Authored-by: zml1206 <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
---
.../src/main/resources/table_command_spec.json | 14 +++++++++++++-
.../kyuubi/plugin/spark/authz/gen/DeltaCommands.scala | 6 +++++-
.../ranger/DeltaCatalogRangerSparkExtensionSuite.scala | 17 +++++++++++++++++
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git
a/extensions/spark/kyuubi-spark-authz/src/main/resources/table_command_spec.json
b/extensions/spark/kyuubi-spark-authz/src/main/resources/table_command_spec.json
index a133c981c..e4fb863c3 100644
---
a/extensions/spark/kyuubi-spark-authz/src/main/resources/table_command_spec.json
+++
b/extensions/spark/kyuubi-spark-authz/src/main/resources/table_command_spec.json
@@ -2153,7 +2153,19 @@
} ],
"opType" : "MSCK",
"queryDescs" : [ ],
- "uriDescs" : [ ]
+ "uriDescs" : [ {
+ "fieldName" : "child",
+ "fieldExtractor" : "ResolvedTableURIExtractor",
+ "isInput" : false
+ }, {
+ "fieldName" : "table",
+ "fieldExtractor" : "TableIdentifierOptionURIExtractor",
+ "isInput" : false
+ }, {
+ "fieldName" : "path",
+ "fieldExtractor" : "StringURIExtractor",
+ "isInput" : false
+ } ]
}, {
"classname" : "org.apache.spark.sql.delta.commands.DeleteCommand",
"tableDescs" : [ {
diff --git
a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/DeltaCommands.scala
b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/DeltaCommands.scala
index ed7c89bed..d40caae7e 100644
---
a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/DeltaCommands.scala
+++
b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/DeltaCommands.scala
@@ -60,7 +60,11 @@ object DeltaCommands extends CommandSpecs[TableCommandSpec] {
val cmd = "io.delta.tables.execution.VacuumTableCommand"
val childDesc = TableDesc("child", classOf[ResolvedTableTableExtractor])
val tableDesc = TableDesc("table",
classOf[TableIdentifierOptionTableExtractor])
- TableCommandSpec(cmd, Seq(childDesc, tableDesc), MSCK)
+ val uriDescs = Seq(
+ UriDesc("child", classOf[ResolvedTableURIExtractor]),
+ UriDesc("table", classOf[TableIdentifierOptionURIExtractor]),
+ UriDesc("path", classOf[StringURIExtractor]))
+ TableCommandSpec(cmd, Seq(childDesc, tableDesc), MSCK, uriDescs = uriDescs)
}
override def specs: Seq[TableCommandSpec] = Seq(
diff --git
a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/DeltaCatalogRangerSparkExtensionSuite.scala
b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/DeltaCatalogRangerSparkExtensionSuite.scala
index c7956c968..c1dda6989 100644
---
a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/DeltaCatalogRangerSparkExtensionSuite.scala
+++
b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/DeltaCatalogRangerSparkExtensionSuite.scala
@@ -451,6 +451,23 @@ class DeltaCatalogRangerSparkExtensionSuite extends
RangerSparkExtensionSuite {
doAs(admin, sql(optimizeTableSql2))
})
}
+
+ test("vacuum path-based table") {
+ withTempDir(path => {
+ doAs(admin, sql(createPathBasedTableSql(path)))
+ val vacuumTableSql1 = s"VACUUM delta.`$path`"
+ interceptEndsWith[AccessControlException](
+ doAs(someone, sql(vacuumTableSql1)))(
+ s"does not have [write] privilege on [[$path, $path/]]")
+ doAs(admin, sql(vacuumTableSql1))
+
+ val vacuumTableSql2 = s"VACUUM '$path'"
+ interceptEndsWith[AccessControlException](
+ doAs(someone, sql(vacuumTableSql2)))(
+ s"does not have [write] privilege on [[$path, $path/]]")
+ doAs(admin, sql(vacuumTableSql2))
+ })
+ }
}
object DeltaCatalogRangerSparkExtensionSuite {