dejii commented on code in PR #38269:
URL: https://github.com/apache/beam/pull/38269#discussion_r3148711564


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/AddFiles.java:
##########
@@ -522,12 +531,18 @@ private Table getOrCreateTable(String filePath, 
FileFormat format) throws IOExce
         try {
           org.apache.iceberg.Schema schema = getSchema(filePath, format);
           PartitionSpec spec = PartitionUtils.toPartitionSpec(partitionFields, 
schema);
+          SortOrder sortOrder = SortOrderUtils.toSortOrder(sortFields, schema);
 
-          return tableProps == null
-              ? 
catalogConfig.catalog().createTable(TableIdentifier.parse(identifier), schema, 
spec)
-              : catalogConfig
+          Catalog.TableBuilder builder =
+              catalogConfig
                   .catalog()
-                  .createTable(TableIdentifier.parse(identifier), schema, 
spec, tableProps);
+                  .buildTable(tableId, schema)
+                  .withPartitionSpec(spec)
+                  .withSortOrder(sortOrder);

Review Comment:
   Yeah stumbled on it while looking for a way to apply the sort order 😅 



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