pvary commented on code in PR #14964:
URL: https://github.com/apache/iceberg/pull/14964#discussion_r2682161184


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/procedures/RewriteDataFilesProcedure.java:
##########
@@ -114,11 +118,23 @@ public Iterator<Scan> call(InternalRow args) {
     String sortOrderString = input.asString(SORT_ORDER_PARAM, null);
     Map<String, String> options = input.asStringMap(OPTIONS_PARAM, 
ImmutableMap.of());
     String where = input.asString(WHERE_PARAM, null);
+    String explicitBranch = input.asString(BRANCH_PARAM, null);
+
+    // Determine target branch: explicit parameter > table branch > main branch
+    String targetBranch = explicitBranch;
+    if (targetBranch == null) {
+      targetBranch = loadSparkTable(tableIdent).branch();
+    }
+    if (targetBranch == null) {
+      targetBranch = SnapshotRef.MAIN_BRANCH;
+    }
+    String branch = targetBranch;

Review Comment:
   ```suggestion
       // Determine target branch: explicit parameter > table branch > main 
branch
       String branch = input.asString(BRANCH_PARAM, null);
       if (branch == null) {
         branch = loadSparkTable(tableIdent).branch();
         if (branch == null) {
           branch = SnapshotRef.MAIN_BRANCH;
         }
       }
   ```



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