rdblue commented on a change in pull request #1508:
URL: https://github.com/apache/iceberg/pull/1508#discussion_r716271989



##########
File path: core/src/main/java/org/apache/iceberg/BaseTableScan.java
##########
@@ -123,8 +124,14 @@ public TableScan useSnapshot(long scanSnapshotId) {
         "Cannot override snapshot, already set to id=%s", 
context.snapshotId());
     Preconditions.checkArgument(ops.current().snapshot(scanSnapshotId) != null,
         "Cannot find snapshot with ID %s", scanSnapshotId);
-    return newRefinedScan(
-        ops, table, schema, context.useSnapshotId(scanSnapshotId));
+    if (this instanceof DataTableScan) {
+      Schema snapshotSchema = SnapshotUtil.schemaFor(table, scanSnapshotId);
+      return newRefinedScan(
+          ops, table, snapshotSchema, context.useSnapshotId(scanSnapshotId));
+    } else {
+      return newRefinedScan(
+          ops, table, schema, context.useSnapshotId(scanSnapshotId));

Review comment:
       Looks like the implementation of `SnapshotUtil.snapshotIdAsOfTime` was 
copied from the `asOfTime` method below, but the method below wasn't updated to 
use the utility. Can you fix that? I think you can change it to this:
   
   ```java
     @Override
     public TableScan asOfTime(long timestampMillis) {
       Preconditions.checkArgument(context.snapshotId() == null,
           "Cannot override snapshot, already set to id=%s", 
context.snapshotId());
   
       return useSnapshot(SnapshotUtil.snapshotIdAsOfTime(table(), 
timestampMillis));
     }
   ```




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