[KYUUBI #6942] Test Rename Column Name for paimon

### Why are the changes needed?

Currently, ranger check for paimon missing rename column name command, add the test case
#6942

### How was this patch tested?

Test Paimon Rename column name with ranger

### Was this patch authored or co-authored using generative AI tooling?

No

Closes #6946 from davidyuan1223/test_rename_column_name.

Closes #6942

8e49eb0ab [davidyuan] test rename column name

Authored-by: davidyuan <yuanfuyuan@mafengwo.com>
Signed-off-by: Kent Yao <yao@apache.org>
This commit is contained in:
davidyuan 2025-03-03 09:56:42 +08:00 committed by Kent Yao
parent 9daf74d9c3
commit bfcf2e708f
No known key found for this signature in database
GPG Key ID: F7051850A0AF904D

View File

@ -170,6 +170,23 @@ class PaimonCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite {
}
}
test("Rename Column Name") {
withCleanTmpResources(Seq(
(s"$catalogV2.$namespace1.$table1", "table"))) {
val createTable = createTableSql(namespace1, table1)
doAs(admin, sql(createTable))
val renameColumnSql =
s"""
|ALTER TABLE $catalogV2.$namespace1.$table1
|RENAME COLUMN name TO name1
|""".stripMargin
interceptEndsWith[AccessControlException] {
doAs(someone, sql(renameColumnSql))
}(s"does not have [alter] privilege on [$namespace1/$table1]")
doAs(admin, sql(renameColumnSql))
}
}
def createTableSql(namespace: String, table: String): String =
s"""
|CREATE TABLE IF NOT EXISTS $catalogV2.$namespace.$table