snuyanzin commented on code in PR #27807:
URL: https://github.com/apache/flink/pull/27807#discussion_r2990002051
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/utils/MaterializedTableUtils.java:
##########
@@ -294,29 +295,43 @@ public static List<Column> validateAndExtractNewColumns(
originalColumnSize, newColumnSize));
}
+ final List<TableChange> columnChanges = new ArrayList<>();
for (int i = 0; i < oldColumns.size(); i++) {
Column oldColumn = oldColumns.get(i);
- Column newColumn = newColumns.get(i);
+ Column newColumn =
+ schemaDefinedInQuery
+ ? newColumns.get(i)
+ :
newColumns.get(i).copy(newColumns.get(i).getDataType().nullable());
if (!oldColumn.equals(newColumn)) {
- throw new ValidationException(
- String.format(
- "When modifying the query of a materialized
table, "
- + "currently only support appending
columns at the end of original schema, dropping, renaming, and reordering
columns are not supported.\n"
- + "Column mismatch at position %d:
Original column is [%s], but new column is [%s].",
- i, oldColumn, newColumn));
+ if (!oldColumn.getName().equals(newColumn.getName())
+ || !LogicalTypeCasts.supportsImplicitCast(
+ oldColumn.getDataType().getLogicalType(),
+ newColumn.getDataType().getLogicalType())) {
Review Comment:
funny thing that implicit cast still has issues, I reverted to equals for now
for implicit cast will start an ML thread first
--
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]