zhangjun0x01 commented on code in PR #603:
URL: https://github.com/apache/flink-table-store/pull/603#discussion_r1137247002
##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java:
##########
@@ -310,6 +311,27 @@ public TableSchema commitChanges(List<SchemaChange>
changes) throws Exception {
field.name(),
field.type(),
update.newDescription()));
+ } else if (change instanceof UpdateColumnPosition) {
+ UpdateColumnPosition update = (UpdateColumnPosition)
change;
+ SchemaChange.Move move = update.move();
+
+ // key: name ; value : index
+ Map<String, Integer> map = new HashMap<>();
+ for (int i = 0; i < newFields.size(); i++) {
+ map.put(newFields.get(i).name(), i);
+ }
+
+ int fieldIndex = map.get(move.fieldName());
+ int refIndex = 0;
+ if (move.type().equals(SchemaChange.Move.MoveType.FIRST)) {
+ checkMoveIndexEqual(move, fieldIndex, refIndex);
+ newFields.add(refIndex, newFields.remove(fieldIndex));
+ } else if
(move.type().equals(SchemaChange.Move.MoveType.AFTER)) {
+ refIndex = map.get(move.referenceFieldName());
+ checkMoveIndexEqual(move, fieldIndex, refIndex);
+ newFields.add(refIndex + 1,
newFields.remove(fieldIndex));
Review Comment:
yes,it is a bug ,I fixed it
--
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]