linyanghao commented on code in PR #7628:
URL: https://github.com/apache/iceberg/pull/7628#discussion_r1264720260
##########
flink/v1.17/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogTable.java:
##########
@@ -357,6 +358,213 @@ public void testAlterTableWithPrimaryKey() throws
TableNotExistException {
Assert.assertEquals(properties, table("tl").properties());
}
+ @Test
+ public void testAlterTableProperties() throws TableNotExistException {
+ sql("CREATE TABLE tl(id BIGINT) WITH ('oldK'='oldV')");
+ Map<String, String> properties = Maps.newHashMap();
+ properties.put("oldK", "oldV");
+
+ // new
+ sql("ALTER TABLE tl SET('newK'='newV')");
+ properties.put("newK", "newV");
+ Assert.assertEquals(properties, table("tl").properties());
+
+ // update old
+ sql("ALTER TABLE tl SET('oldK'='oldV2')");
+ properties.put("oldK", "oldV2");
+ Assert.assertEquals(properties, table("tl").properties());
+
+ // remove property
+ sql("ALTER TABLE tl RESET('oldK')");
+ properties.remove("oldK");
+ Assert.assertEquals(properties, table("tl").properties());
+ }
+
+ @Test
+ public void testAlterTableAddColumn() {
+ sql("CREATE TABLE tl(id BIGINT)");
+ Schema schemaBefore = table("tl").schema();
+ Assert.assertEquals(
+ new Schema(Types.NestedField.optional(1, "id",
Types.LongType.get())).asStruct(),
+ schemaBefore.asStruct());
+
+ sql("ALTER TABLE tl ADD (dt STRING)");
+ Schema schemaAfter = table("tl").schema();
+ Assert.assertEquals(
+ new Schema(
+ Types.NestedField.optional(1, "id", Types.LongType.get()),
+ Types.NestedField.optional(2, "dt", Types.StringType.get()))
+ .asStruct(),
+ schemaAfter.asStruct());
+ }
+
+ @Test
+ public void testAlterTableDropColumn() {
Review Comment:
Sure, will add more tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]