LuciferYang commented on code in PR #13448:
URL: https://github.com/apache/gravitino/pull/13448#discussion_r4082457445


##########
core/src/test/java/org/apache/gravitino/catalog/TestManagedTableOperations.java:
##########
@@ -336,6 +336,52 @@ private Column createColumn(String name, Type dataType, 
Expression defaultValue)
         .build();
   }
 
+  @Test
+  public void testAlterTableBundledColumnChanges() {
+    NameIdentifier tableIdent =
+        NameIdentifierUtil.ofTable(METALAKE_NAME, CATALOG_NAME, SCHEMA_NAME, 
"bundled");
+    Column[] columns =
+        new Column[] {
+          createColumn("col1", Types.StringType.get(), null),
+          createColumn("col2", Types.IntegerType.get(), 
Literals.integerLiteral(1)),
+          createColumn("col3", Types.StringType.get(), null)
+        };
+    tableOperations.createTable(
+        tableIdent,
+        columns,
+        "Test bundled alters",
+        StringIdentifier.newPropertiesWithId(
+            StringIdentifier.fromId(idGenerator.nextId()), 
Collections.emptyMap()),
+        new Transform[0],
+        Distributions.NONE,
+        new SortOrder[0],
+        Indexes.EMPTY_INDEXES);
+
+    // A delete of a lower-position column followed by an update of a
+    // higher-position one must neither crash nor reorder the remaining 
columns.
+    Table updated =
+        tableOperations.alterTable(
+            tableIdent,
+            TableChange.deleteColumn(new String[] {"col1"}, false),
+            TableChange.updateColumnComment(new String[] {"col3"}, "updated"));

Review Comment:
   Done. The test now asserts col3's comment is `"updated"` after the first 
bundle and `"updated again"` after the second, so it verifies the update 
actually applied, not just the ordering.



-- 
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]

Reply via email to