[KYUUBI #6951] Test changing column type

### Why are the changes needed?

Ranger check test case missing paimon changing column type command, add the test case
#6951

### How was this patch tested?

Test ranger check paimon changing column type command

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

No

This patch had conflicts when merged, resolved by
Committer: Cheng Pan <chengpan@apache.org>

Closes #6956 from davidyuan1223/test_changing_column_type.

Closes #6951

9d5140e81 [davidyuan] Merge branch 'master' into test_changing_column_type
e4f8974d8 [davidyuan] test changing column type

Authored-by: davidyuan <yuanfuyuan@mafengwo.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
davidyuan 2025-03-17 16:20:33 +08:00 committed by Cheng Pan
parent 3641d9fb0a
commit e1393247f7
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D

View File

@ -531,6 +531,24 @@ class PaimonCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite {
}
}
test("Changing Column Type") {
withCleanTmpResources(Seq(
(s"$catalogV2.$namespace1.$table1", "table"))) {
val createTable = createTableSql(namespace1, table1)
doAs(admin, sql(createTable))
val changingColumnTypeSql =
s"""
|ALTER TABLE $catalogV2.$namespace1.$table1
|ALTER COLUMN id TYPE DOUBLE
|""".stripMargin
interceptEndsWith[AccessControlException] {
doAs(someone, sql(changingColumnTypeSql))
}(s"does not have [alter] privilege on [$namespace1/$table1]")
doAs(admin, sql(changingColumnTypeSql))
}
}
def createTableSql(namespace: String, table: String): String =
s"""
|CREATE TABLE IF NOT EXISTS $catalogV2.$namespace.$table