TyrantLucifer commented on code in PR #5865:
URL: https://github.com/apache/seatunnel/pull/5865#discussion_r1396764561


##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/OrcWriteStrategy.java:
##########
@@ -74,13 +74,14 @@ public void write(@NonNull SeaTunnelRow seaTunnelRow) {
         Writer writer = getOrCreateWriter(filePath);
         TypeDescription schema = buildSchemaWithRowType();
         VectorizedRowBatch rowBatch = schema.createRowBatch();
-        int i = 0;
         int row = rowBatch.size++;
-        for (Integer index : sinkColumnsIndexInRow) {
-            Object value = seaTunnelRow.getField(index);
-            ColumnVector vector = rowBatch.cols[i];
-            setColumn(value, vector, row);
-            i++;
+        for (int i = 0; i < sinkColumnsIndexInRow.size(); i++) {
+            Integer index = sinkColumnsIndexInRow.indexOf(i);
+            if (index != null) {
+                Object value = seaTunnelRow.getField(index);
+                ColumnVector vector = rowBatch.cols[i];
+                setColumn(value, vector, row);
+            }

Review Comment:
   Could you please explain what't the meaning of this? I have some concern. 
The sinkColumnsIndexInRow array holds the field index values to be sent to 
downstream fields in the upstream row, why need invoke the `indexOf` method for 
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]

Reply via email to