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 a133c981c86..e4fb863c35d 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 ed7c89bed40..d40caae7eba 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 c7956c96824..c1dda69896a 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 {