rdblue commented on code in PR #6965:
URL: https://github.com/apache/iceberg/pull/6965#discussion_r1132981700
##########
core/src/main/java/org/apache/iceberg/SnapshotScan.java:
##########
@@ -85,11 +85,16 @@ 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()));
+ TableScanContext newContext =
context().useSnapshotId(snapshot.snapshotId());
+ return newRefinedScan(table(), SnapshotUtil.schemaFor(table(), name),
newContext);
Review Comment:
Good catch with the schema.
--
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]