Skip to content

Commit ed96ac1

Browse files
davidyuan1223pan3793
authored andcommitted
[KYUUBI #6921][AUTHZ] Test CTAS for Paimon
### Why are the changes needed? AUTHZ Test CTAS for Paimon to check it support this command, the related issue is #6921 ### How was this patch tested? Test Authz for paimon with create table as command. Check the permission. ### Was this patch authored or co-authored using generative AI tooling? No Closes #6922 from davidyuan1223/support_create_table_as_for_paimon_check. Closes #6921 7bfd6ad [david yuan] Update extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/PaimonCatalogRangerSparkExtensionSuite.scala a9ce20c [davidyuan] support create table as for paimon Lead-authored-by: davidyuan <[email protected]> Co-authored-by: david yuan <[email protected]> Signed-off-by: Cheng Pan <[email protected]>
1 parent 93ac1ee commit ed96ac1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/PaimonCatalogRangerSparkExtensionSuite.scala

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,27 @@ class PaimonCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite {
100100
}
101101
}
102102

103+
test("CTAS") {
104+
val table2 = "table2"
105+
withCleanTmpResources(Seq(
106+
(s"$catalogV2.$namespace1.$table1", "table"),
107+
(s"$catalogV2.$namespace1.$table2", "table"))) {
108+
val createTable = createTableSql(namespace1, table1)
109+
doAs(admin, sql(createTable))
110+
val createTableAsSql =
111+
s"""
112+
|CREATE TABLE IF NOT EXISTS $catalogV2.$namespace1.$table2
113+
|USING paimon
114+
|AS
115+
|SELECT * FROM $catalogV2.$namespace1.$table1
116+
|""".stripMargin
117+
interceptEndsWith[AccessControlException] {
118+
doAs(someone, sql(createTableAsSql))
119+
}(s"does not have [select] privilege on [$namespace1/$table1/id]")
120+
doAs(admin, sql(createTableAsSql))
121+
}
122+
}
123+
103124
def createTableSql(namespace: String, table: String): String =
104125
s"""
105126
|CREATE TABLE IF NOT EXISTS $catalogV2.$namespace.$table

0 commit comments

Comments
 (0)