nastra commented on code in PR #8797:
URL: https://github.com/apache/iceberg/pull/8797#discussion_r1354320039


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteDataFilesSparkAction.java:
##########
@@ -146,13 +148,29 @@ public RewriteDataFilesSparkAction filter(Expression 
expression) {
     return this;
   }
 
+  @Override
+  public RewriteDataFiles targetBranch(String branch) {
+    this.targetBranch = branch;
+    return this;
+  }
+
+  protected long startingSnapshotId() {
+    if (SnapshotRef.MAIN_BRANCH.equals(this.targetBranch)) {
+      return table.currentSnapshot().snapshotId();
+    } else {
+      SnapshotRef ref = table.refs().get(this.targetBranch);
+      assert (ref != null);

Review Comment:
   we typically don't use `assert` because they need to be enabled. So what 
makes more sense is to use `Preconditions.checkArgument(...)`



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to