amogh-jahagirdar commented on code in PR #5150:
URL: https://github.com/apache/iceberg/pull/5150#discussion_r1008768894


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -226,6 +222,12 @@ public Scan build() {
       scan = scan.asOfTime(asOfTimestamp);
     }
 
+    if (branch != null) {
+      scan.useRef(branch);
+    } else if (tag != null) {
+      scan.useRef(tag);
+    }

Review Comment:
   I think the issue is that scan.useRef(tag) by itself doesn't update the 
snapshot in the context on the existing scan; it's a builder like pattern so it 
needs to be `scan = scan.useRef(ref)`. That's why the tests are failing; the 
context snapshot isn't set, so by default the scan reads main. 



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