pandeysambhi commented on code in PR #8456:
URL: https://github.com/apache/gravitino/pull/8456#discussion_r2369954377
##########
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:
@mchades From what I understood , L279 would check for empty deleteColSql
and hence L280 would not be executed. then at L321 , following check would lead
to an empty string return. as aletrSql is initialised with an empty arraylist.
if (CollectionUtils.isEmpty(alterSql)) {
return "";
}
--
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]