wooyeong commented on code in PR #9455:
URL: https://github.com/apache/iceberg/pull/9455#discussion_r1476136487


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java:
##########
@@ -131,12 +133,12 @@ public SparkTable(Table icebergTable, boolean 
refreshEagerly) {
   public SparkTable(Table icebergTable, String branch, boolean refreshEagerly) 
{
     this(icebergTable, refreshEagerly);
     this.branch = branch;
+    final Snapshot snapshot = icebergTable.snapshot(branch);
     ValidationException.check(
-        branch == null
-            || SnapshotRef.MAIN_BRANCH.equals(branch)
-            || icebergTable.snapshot(branch) != null,
+        branch == null || SnapshotRef.MAIN_BRANCH.equals(branch) || snapshot 
!= null,
         "Cannot use branch (does not exist): %s",
         branch);
+    this.snapshotId = snapshot.snapshotId();

Review Comment:
   Sorry, I misunderstood the constructor. Fixed and confirmed on my local. 
`./gradlew -DsparkVersions=3.5 -DscalaVersion=2.12 -DhiveVersions= 
-DflinkVersions= :iceberg-spark:iceberg-spark-3.5_2.12:check 
:iceberg-spark:iceberg-spark-extensions-3.5_2.12:check 
:iceberg-spark:iceberg-spark-runtime-3.5_2.12:check -Pquick=true -x javadoc`



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