JingsongLi commented on code in PR #1416:
URL: https://github.com/apache/incubator-paimon/pull/1416#discussion_r1236290098


##########
paimon-core/src/main/java/org/apache/paimon/mergetree/compact/PartialUpdateMergeFunction.java:
##########
@@ -190,11 +193,36 @@ private Factory(Options options, RowType rowType) {
         @Override
         public MergeFunction<KeyValue> create(@Nullable int[][] projection) {
             List<DataType> fieldTypes = tableTypes;
+            Map<Integer, SequenceGenerator> projFieldSequences = new 
HashMap<>();
+
             if (projection != null) {
                 fieldTypes = Projection.of(projection).project(tableTypes);
+                int[] fieldOldIndex = 
Projection.of(projection).toTopLevelIndexes();
+                Map<Integer, Integer> indexMap = new HashMap<>();
+                for (int i = 0; i < fieldOldIndex.length; i++) {
+                    indexMap.put(fieldOldIndex[i], i);
+                }
+                for (int index = 0; index < fieldOldIndex.length; index++) {

Review Comment:
   loop `fieldSequences` like this:
   ```
   fieldSequences.forEach((field, sequence) -> {
       int newField = indexMap.get(field);
       if (newField != -1) {
          int newSequenceId = indexMap.get(sequence.index());
          checkArguement(newSequenceId != -1);
          projectedFieldSequences.put(newField, new 
SequenceGenerator(newSequenceId, ...));
       }
   }); 
   ```



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