wombatu-kun commented on code in PR #16654:
URL: https://github.com/apache/iceberg/pull/16654#discussion_r3740589777


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/RecordConverter.java:
##########
@@ -95,11 +95,19 @@ class RecordConverter {
   private final NameMapping nameMapping;
   private final IcebergSinkConfig config;
   private final Map<Integer, Map<String, NestedField>> structNameMap = 
Maps.newHashMap();
+  // Parquet stores UUIDs as a 16-byte fixed; other formats keep the UUID 
logical type. The write
+  // file format is fixed for the converter's lifetime, so resolve this once 
instead of per value.
+  private final boolean writeUuidAsBytes;
 
   RecordConverter(Table table, IcebergSinkConfig config) {
     this.tableSchema = table.schema();
     this.nameMapping = createNameMapping(table);
     this.config = config;
+    this.writeUuidAsBytes =
+        FileFormat.PARQUET
+            .name()
+            .toLowerCase(Locale.ROOT)
+            
.equals(config.writeProps().get(TableProperties.DEFAULT_FILE_FORMAT));

Review Comment:
   Hardening the comparison would widen a branch that needs removing instead: 
it has thrown `ClassCastException: [B cannot be cast to java.util.UUID` since 
#11904 changed the Parquet UUID writer to take a `java.util.UUID`. Tracked in 
#17076, fix in #17079.



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