Copilot commented on code in PR #10383:
URL: https://github.com/apache/gravitino/pull/10383#discussion_r2918195511
##########
catalogs-contrib/catalog-jdbc-clickhouse/src/test/java/org/apache/gravitino/catalog/clickhouse/integration/test/CatalogClickHouseClusterIT.java:
##########
@@ -356,4 +361,92 @@ public void
testLoadSqlCreatedLocalAndDistributedTableProperties() {
Assertions.assertEquals(
sqlNonClusterLocalTableName,
sqlNonClusterDistributedTable.properties().get(REMOTE_TABLE));
}
+
+ @Test
+ public void testAlterTableBranchCoverageInCluster() {
+ String alterTableName = GravitinoITUtils.genRandomName("ck_cluster_alter");
+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName,
alterTableName);
+ Column[] columns = createColumns();
+ Index[] indexes =
+ new Index[] {
+ Indexes.of(Index.IndexType.DATA_SKIPPING_MINMAX, "idx_col_2", new
String[][] {{"col_2"}})
+ };
+ TableCatalog tableCatalog = catalog.asTableCatalog();
+ tableCatalog.createTable(
+ tableIdentifier,
+ columns,
+ tableComment,
+ clusterMergeTreeProperties(),
+ Transforms.EMPTY_TRANSFORM,
+ Distributions.NONE,
+ getSortOrders("col_3"),
+ indexes);
+
+ tableCatalog.alterTable(
+ tableIdentifier,
+ TableChange.addColumn(
+ new String[] {"col_4"},
+ Types.StringType.get(),
+ "new col",
+ TableChange.ColumnPosition.first()),
+ TableChange.updateColumnPosition(
+ new String[] {"col_2"},
TableChange.ColumnPosition.after("col_3")));
+ tableCatalog.alterTable(
Review Comment:
The test triggers `updateColumnPosition(col_2 after col_3)` but the
assertions only check that `col_4` is first, so a regression where `col_2`
isn’t moved would still pass. Add an assertion on the final column ordering (or
specifically that `col_2` appears after `col_3`) after `loadTable`.
##########
catalogs-contrib/catalog-jdbc-clickhouse/src/test/java/org/apache/gravitino/catalog/clickhouse/integration/test/CatalogClickHouseClusterIT.java:
##########
@@ -356,4 +361,92 @@ public void
testLoadSqlCreatedLocalAndDistributedTableProperties() {
Assertions.assertEquals(
sqlNonClusterLocalTableName,
sqlNonClusterDistributedTable.properties().get(REMOTE_TABLE));
}
+
+ @Test
+ public void testAlterTableBranchCoverageInCluster() {
+ String alterTableName = GravitinoITUtils.genRandomName("ck_cluster_alter");
+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName,
alterTableName);
+ Column[] columns = createColumns();
+ Index[] indexes =
+ new Index[] {
+ Indexes.of(Index.IndexType.DATA_SKIPPING_MINMAX, "idx_col_2", new
String[][] {{"col_2"}})
+ };
+ TableCatalog tableCatalog = catalog.asTableCatalog();
+ tableCatalog.createTable(
+ tableIdentifier,
+ columns,
+ tableComment,
+ clusterMergeTreeProperties(),
+ Transforms.EMPTY_TRANSFORM,
+ Distributions.NONE,
+ getSortOrders("col_3"),
+ indexes);
+
+ tableCatalog.alterTable(
+ tableIdentifier,
+ TableChange.addColumn(
+ new String[] {"col_4"},
+ Types.StringType.get(),
+ "new col",
+ TableChange.ColumnPosition.first()),
+ TableChange.updateColumnPosition(
+ new String[] {"col_2"},
TableChange.ColumnPosition.after("col_3")));
+ tableCatalog.alterTable(
+ tableIdentifier,
+ TableChange.updateColumnType(new String[] {"col_1"},
Types.LongType.get()));
+ tableCatalog.alterTable(
+ tableIdentifier,
+ TableChange.updateColumnComment(new String[] {"col_1"},
"col_1_new_comment"));
+ tableCatalog.alterTable(
+ tableIdentifier,
+ TableChange.updateColumnDefaultValue(
+ new String[] {"col_1"}, Literals.of("2", Types.LongType.get())));
+ tableCatalog.alterTable(
+ tableIdentifier, TableChange.updateColumnNullability(new String[]
{"col_1"}, true));
Review Comment:
The test exercises `updateColumnDefaultValue` but never asserts the loaded
table’s `col_1` default value actually changed. Without an assertion,
regressions in default-value SQL generation could still pass this test. Add a
post-alter assertion against `alteredCol1.defaultValue()` (or locate the column
and verify its default expression/value).
--
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]