Hisoka-X commented on code in PR #8017:
URL: https://github.com/apache/seatunnel/pull/8017#discussion_r1837978088


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/AbstractJdbcSinkWriter.java:
##########
@@ -88,8 +89,23 @@ protected void 
processSchemaChangeEvent(AlterTableColumnEvent event) throws IOEx
         List<Column> columns = newTableSchema.getColumns();
         switch (event.getEventType()) {
             case SCHEMA_CHANGE_ADD_COLUMN:
-                Column addColumn = ((AlterTableAddColumnEvent) 
event).getColumn();
-                columns.add(addColumn);
+                AlterTableAddColumnEvent alterTableAddColumnEvent =
+                        (AlterTableAddColumnEvent) event;
+                Column addColumn = alterTableAddColumnEvent.getColumn();
+                String afterColumn = alterTableAddColumnEvent.getAfterColumn();
+                if (StringUtils.isNotBlank(afterColumn)) {
+                    Optional<Column> columnOptional =
+                            columns.stream()
+                                    .filter(column -> 
afterColumn.equals(column.getName()))
+                                    .findFirst();
+                    columnOptional.ifPresent(

Review Comment:
   if not present (basically not happen, but we should care about it), it will 
lose column?



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