rdblue commented on a change in pull request #1508:
URL: https://github.com/apache/iceberg/pull/1508#discussion_r716269011
##########
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) {
Review comment:
Instead of checking for a specific subclass, I think it is cleaner to
override the method in `DataTableScan`. Here's what I was able to get working:
```java
@Override
public TableScan useSnapshot(long scanSnapshotId) {
TableScan newScan = super.useSnapshot(scanSnapshotId);
if (newScan.snapshot().schemaId() != null) {
Schema snapshotSchema = SnapshotUtil.schemaFor(table(),
scanSnapshotId);
return newRefinedScan(tableOps(), table(), snapshotSchema,
context().useSnapshotId(scanSnapshotId));
}
return newScan;
}
```
--
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]