[KYUUBI #6950] Test changing column position

### Why are the changes needed?

Ranger check test case missing paimon changing column position command, add the test case
#6950

### How was this patch tested?

Test ranger check with paimon changing column position command

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

No

Closes #6955 from davidyuan1223/test_changing_column_position.

Closes #6950

520b5377f [davidyuan] Merge branch 'master' into test_changing_column_position
1eed87346 [davidyuan] test changing column position

Authored-by: davidyuan <yuanfuyuan@mafengwo.com>
Signed-off-by: Kent Yao <yao@apache.org>
This commit is contained in:
davidyuan 2025-03-04 16:52:25 +08:00 committed by Kent Yao
parent d5b01fa3e2
commit 4cab817913
No known key found for this signature in database
GPG Key ID: F7051850A0AF904D

View File

@ -187,6 +187,43 @@ class PaimonCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite {
}
}
test("Changing Column Position") {
withCleanTmpResources(Seq(
(s"$catalogV2.$namespace1.$table1", "table"))) {
val createTableSql =
s"""
|CREATE TABLE IF NOT EXISTS $catalogV2.$namespace1.$table1
|(id int, name string, a int, b int)
|USING paimon
|OPTIONS (
| 'primary-key' = 'id'
|)
|""".stripMargin
doAs(admin, sql(createTableSql))
val changingColumnPositionToFirst =
s"""
|ALTER TABLE $catalogV2.$namespace1.$table1
|ALTER COLUMN a FIRST
|""".stripMargin
interceptEndsWith[AccessControlException] {
doAs(someone, sql(changingColumnPositionToFirst))
}(s"does not have [alter] privilege on [$namespace1/$table1]")
doAs(admin, sql(changingColumnPositionToFirst))
val changingColumnPositionToAfter =
s"""
|ALTER TABLE $catalogV2.$namespace1.$table1
|ALTER COLUMN a AFTER name
|""".stripMargin
interceptEndsWith[AccessControlException] {
doAs(someone, sql(changingColumnPositionToAfter))
}(s"does not have [alter] privilege on [$namespace1/$table1]")
doAs(admin, sql(changingColumnPositionToAfter))
}
}
def createTableSql(namespace: String, table: String): String =
s"""
|CREATE TABLE IF NOT EXISTS $catalogV2.$namespace.$table