aokolnychyi commented on code in PR #6965:
URL: https://github.com/apache/iceberg/pull/6965#discussion_r1129768750


##########
core/src/main/java/org/apache/iceberg/SnapshotScan.java:
##########
@@ -85,11 +85,18 @@ public ThisT useSnapshot(long scanSnapshotId) {
   }
 
   public ThisT useRef(String name) {
+    if (SnapshotRef.MAIN_BRANCH.equals(name)) {
+      return newRefinedScan(table(), tableSchema(), context());
+    }
+
     Preconditions.checkArgument(
         snapshotId() == null, "Cannot override ref, already set snapshot 
id=%s", snapshotId());
     Snapshot snapshot = table().snapshot(name);
     Preconditions.checkArgument(snapshot != null, "Cannot find ref %s", name);
-    return newRefinedScan(table(), tableSchema(), 
context().useSnapshotId(snapshot.snapshotId()));
+    return newRefinedScan(
+        table(),
+        SnapshotUtil.schemaFor(table(), name),
+        context().useSnapshotId(snapshot.snapshotId()));

Review Comment:
   nit: Can we define an extra variable to so that this call will fit on one 
line?
   
   ```
   TableScanContext newContext = context().useSnapshotId(snapshot.snapshotId());
   return newRefinedScan(table(), SnapshotUtil.schemaFor(table(), name), 
newContext);
   ```



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