aiborodin commented on code in PR #13340:
URL: https://github.com/apache/iceberg/pull/13340#discussion_r2158055293


##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicRecordProcessor.java:
##########
@@ -142,10 +151,18 @@ private void emit(
       Schema schema,
       CompareSchemasVisitor.Result result,
       PartitionSpec spec) {
-    RowData rowData =
-        result == CompareSchemasVisitor.Result.SAME
-            ? data.rowData()
-            : RowDataEvolver.convert(data.rowData(), data.schema(), schema);
+    RowData rowData;
+    if (result == CompareSchemasVisitor.Result.SAME) {
+      rowData = data.rowData();
+    } else {
+      RowDataConverter rowDataConverter =
+          converterCache.get(
+              data.schema(),

Review Comment:
   Yes, this optimisation assumes that `Schema` objects are reused, similar to 
the `SchemaInfo::lastResults` cache. The latter prints a warning 
[here](https://github.com/apache/iceberg/blob/main/flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableMetadataCache.java#L248)
 if it is not the case. The `Schema` contract also enforces this by using the 
identity `equals()` and `hashCode()` implementations.
   
   This code will be merged into the `TableMetadataCache` in the following PR, 
so we will consolidate these assumptions in one place.



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


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

Reply via email to