github-actions[bot] commented on code in PR #64134:
URL: https://github.com/apache/doris/pull/64134#discussion_r3378105710


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergUtils.java:
##########
@@ -1158,6 +1153,39 @@ public static FileFormat getFileFormat(Table 
icebergTable) {
         return fileFormat;
     }
 
+    private static String resolveFileFormatName(Table icebergTable, 
Map<String, String> properties) {
+        // 1. Check "write-format" (nickname in Flink and Spark)
+        if (properties.containsKey(WRITE_FORMAT)) {
+            return properties.get(WRITE_FORMAT);
+        }
+        // 2. Check "write.format.default" (standard Iceberg property)
+        if (properties.containsKey(TableProperties.DEFAULT_FILE_FORMAT)) {
+            return properties.get(TableProperties.DEFAULT_FILE_FORMAT);
+        }
+        // 3. Last resort: infer from the actual data files in the current 
snapshot.
+        //    This handles migrated tables where none of the above properties 
are set.
+        return inferFileFormatFromDataFiles(icebergTable);

Review Comment:
   This fallback chain no longer honors the `format` table property that the 
PR's SQL setup used before (`TBLPROPERTIES ('format'='orc')`). For a migrated 
ORC table that has `format=orc` but no `write-format`/`write.format.default`, 
an empty table (`currentSnapshot() == null`) or a snapshot with no planned 
files falls through to `inferFileFormatFromDataFiles()` and returns 
`PARQUET_NAME`, so subsequent writes/compression/deletes that call 
`getFileFormat()` can choose Parquet for an ORC table. Please keep checking the 
migrated-table `format` property before inference, and keep/add coverage for 
that property rather than changing the test to only use `write.format.default`.



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