mchades commented on code in PR #8456:
URL: https://github.com/apache/gravitino/pull/8456#discussion_r2357241070
##########
catalogs/catalog-jdbc-oceanbase/src/test/java/org/apache/gravitino/catalog/oceanbase/operation/TestOceanBaseTableOperations.java:
##########
@@ -1133,4 +1133,37 @@ public boolean isMySQLDriverVersionSupported(String
driverVersion) {
operationsWithOceanBaseDriver.calculateDatetimePrecision("TIME", 10,
0),
"TIME type should return precision for OceanBase driver");
}
+
+ @Test
+ public void testAlterTableSkipsEmptySql() {
+ String tableName = RandomStringUtils.randomAlphabetic(16).toLowerCase() +
"_skip_empty_sql";
+ List<JdbcColumn> columns = new ArrayList<>();
+ columns.add(
+ JdbcColumn.builder()
+ .withName("col_1")
+ .withType(Types.IntegerType.get())
+ .withNullable(false)
+ .build());
+
+ // Create table
+ TABLE_OPERATIONS.create(
+ TEST_DB_NAME,
+ tableName,
+ columns.toArray(new JdbcColumn[0]),
+ "test_table",
+ Collections.emptyMap(),
+ null,
+ Distributions.NONE,
+ Indexes.EMPTY_INDEXES);
+
+ // Alter table with one valid change and one empty SQL change
+ TableChange validChange =
+ TableChange.updateColumnComment(new String[] {"col_1"}, "Updated
comment");
+ TableChange emptyChange = TableChange.deleteColumn(new String[]
{"non_existent_col"}, true);
Review Comment:
why did you say the `deleteColumn` change is an empty SQL change? I saw it
will skipe the empty generated SQL by 279L:
https://github.com/apache/gravitino/blob/f70a235227042f505cd6ec6982497b5e4c7961ca/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseTableOperations.java#L275-L281
--
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]