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 f654e6bad [KYUUBI #5556][AUTHZ] Support Alter table commands of set
table properties
f654e6bad is described below
commit f654e6bad9bf1973d3d22d12f322267ff03dba08
Author: zml1206 <[email protected]>
AuthorDate: Mon Oct 30 20:32:07 2023 +0800
[KYUUBI #5556][AUTHZ] Support Alter table commands of set table properties
### _Why are the changes needed?_
To close #5556.
Support Alter table commands of set table properties for Delta Lake in
Authz.
https://docs.delta.io/latest/delta-batch.html#table-properties
### _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
- [x] [Run
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
locally before make a pull request
### _Was this patch authored or co-authored using generative AI tooling?_
No.
Closes #5560 from zml1206/KYUUBI-5556.
Closes #5556
3d1f476c7 [zml1206] Support Alter table commands of set table properties
for Delta Lake
Authored-by: zml1206 <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
---
.../src/main/resources/table_command_spec.json | 15 +++++++++++++++
.../kyuubi/plugin/spark/authz/gen/TableCommands.scala | 7 +++++++
.../ranger/DeltaCatalogRangerSparkExtensionSuite.scala | 8 ++++++++
3 files changed, 30 insertions(+)
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 6782fccb5..67e027c6e 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
@@ -532,6 +532,21 @@
"fieldExtractor" : "LogicalPlanQueryExtractor"
} ],
"uriDescs" : [ ]
+}, {
+ "classname" :
"org.apache.spark.sql.catalyst.plans.logical.SetTableProperties",
+ "tableDescs" : [ {
+ "fieldName" : "table",
+ "fieldExtractor" : "ResolvedTableTableExtractor",
+ "columnDesc" : null,
+ "actionTypeDesc" : null,
+ "tableTypeDesc" : null,
+ "catalogDesc" : null,
+ "isInput" : false,
+ "setCurrentDatabaseIfMissing" : false
+ } ],
+ "opType" : "ALTERTABLE_PROPERTIES",
+ "queryDescs" : [ ],
+ "uriDescs" : [ ]
}, {
"classname" : "org.apache.spark.sql.catalyst.plans.logical.ShowCreateTable",
"tableDescs" : [ {
diff --git
a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/TableCommands.scala
b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/TableCommands.scala
index 3abf336cd..e397ba487 100644
---
a/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/TableCommands.scala
+++
b/extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/gen/TableCommands.scala
@@ -594,6 +594,12 @@ object TableCommands extends
CommandSpecs[TableCommandSpec] {
TableCommandSpec(cmd, Seq(tableIdentDesc.copy(isInput = true)))
}
+ val SetTableProperties = {
+ val cmd = "org.apache.spark.sql.catalyst.plans.logical.SetTableProperties"
+ val tableDesc = TableDesc("table", classOf[ResolvedTableTableExtractor])
+ TableCommandSpec(cmd, Seq(tableDesc), ALTERTABLE_PROPERTIES)
+ }
+
override def specs: Seq[TableCommandSpec] = Seq(
AddPartitions,
DropPartitions,
@@ -668,6 +674,7 @@ object TableCommands extends CommandSpecs[TableCommandSpec]
{
RefreshTableV2,
RefreshTable3d0,
ReplaceData,
+ SetTableProperties,
ShowColumns,
ShowCreateTable,
ShowCreateTable.copy(classname =
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 59ced3eb1..e833f03cd 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
@@ -178,6 +178,14 @@ class DeltaCatalogRangerSparkExtensionSuite extends
RangerSparkExtensionSuite {
interceptContains[AccessControlException](
doAs(someone, sql(s"ALTER TABLE $namespace1.$table1 DROP COLUMN
birthDate")))(
s"does not have [alter] privilege on [$namespace1/$table1]")
+
+ // set properties
+ interceptContains[AccessControlException](
+ doAs(
+ someone,
+ sql(s"ALTER TABLE $namespace1.$table1" +
+ s" SET TBLPROPERTIES ('delta.appendOnly' = 'true')")))(
+ s"does not have [alter] privilege on [$namespace1/$table1]")
}
}
}