openinx commented on a change in pull request #2047:
URL: https://github.com/apache/iceberg/pull/2047#discussion_r588000745



##########
File path: flink/src/main/java/org/apache/iceberg/flink/data/RowDataUtil.java
##########
@@ -69,4 +74,30 @@ public static Object convertConstant(Type type, Object 
value) {
     }
     return value;
   }
+
+  /**
+   * Similar to the private {@link RowDataSerializer#copyRowData(RowData, 
RowData)} method.
+   * This skips the check the arity of rowType and from,
+   * because the from RowData may contains additional column for position 
deletes.
+   * Using {@link RowDataSerializer#copy(RowData, RowData)} will fail the 
arity check.
+   */
+  public static RowData clone(RowData from, RowData reuse, RowType rowType, 
TypeSerializer[] fieldSerializers) {

Review comment:
       OK ,  seems we're clone the rowData iterately,  I saw the  `FieldGetter` 
will be created for each row  
[here](https://github.com/apache/iceberg/pull/2047/files#diff-81028bf7f8758383a5976b7c1461931a41485de740642252f5fd0c5c9cec51dfR94),
  that should also not be the expected behavior.  We may need to introduce an 
new `RowDataCloner` which will initialize all its TypeSerializer &  
`FieldGetter` once in instance constructor,  when iterating the `RowData` we 
will just clone row by row don't need to create any extra instances.
   
   Users don't have to interact with the internal `TypeSerializer`,  they could 
just use the `RowDataCloner`.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to