szehon-ho commented on code in PR #6365: URL: https://github.com/apache/iceberg/pull/6365#discussion_r1052806135
########## core/src/main/java/org/apache/iceberg/BaseTableScan.java: ########## @@ -100,77 +49,14 @@ public TableScan appendsAfter(long fromSnapshotId) { throw new UnsupportedOperationException("Incremental scan is not supported"); } - @Override - public TableScan useSnapshot(long scanSnapshotId) { - Preconditions.checkArgument( - snapshotId() == null, "Cannot override snapshot, already set snapshot id=%s", snapshotId()); - Preconditions.checkArgument( - tableOps().current().snapshot(scanSnapshotId) != null, - "Cannot find snapshot with ID %s", - scanSnapshotId); - return newRefinedScan( - tableOps(), table(), tableSchema(), context().useSnapshotId(scanSnapshotId)); - } - - @Override - public TableScan useRef(String name) { - 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( - tableOps(), table(), tableSchema(), context().useSnapshotId(snapshot.snapshotId())); - } - - @Override - public TableScan asOfTime(long timestampMillis) { - Preconditions.checkArgument( - snapshotId() == null, "Cannot override snapshot, already set snapshot id=%s", snapshotId()); - - return useSnapshot(SnapshotUtil.snapshotIdAsOfTime(table(), timestampMillis)); - } - - @Override - public CloseableIterable<FileScanTask> planFiles() { - Snapshot snapshot = snapshot(); - if (snapshot != null) { - LOG.info( - "Scanning table {} snapshot {} created at {} with filter {}", - table(), - snapshot.snapshotId(), - DateTimeUtil.formatTimestampMillis(snapshot.timestampMillis()), - ExpressionUtil.toSanitizedString(filter())); - - Listeners.notifyAll(new ScanEvent(table().name(), snapshot.snapshotId(), filter(), schema())); - List<Integer> projectedFieldIds = Lists.newArrayList(TypeUtil.getProjectedIds(schema())); - List<String> projectedFieldNames = - projectedFieldIds.stream().map(schema()::findColumnName).collect(Collectors.toList()); - - Timer.Timed planningDuration = scanMetrics().totalPlanningDuration().start(); - - return CloseableIterable.whenComplete( - doPlanFiles(), - () -> { - planningDuration.stop(); - Map<String, String> metadata = Maps.newHashMap(context().options()); - metadata.putAll(EnvironmentContext.get()); - ScanReport scanReport = - ImmutableScanReport.builder() - .schemaId(schema().schemaId()) - .projectedFieldIds(projectedFieldIds) - .projectedFieldNames(projectedFieldNames) - .tableName(table().name()) - .snapshotId(snapshot.snapshotId()) - .filter(ExpressionUtil.sanitize(filter())) - .scanMetrics(ScanMetricsResult.fromScanMetrics(scanMetrics())) - .metadata(metadata) - .build(); - context().metricsReporter().report(scanReport); - }); - } else { - LOG.info("Scanning empty table {}", table()); - return CloseableIterable.empty(); - } + /** Review Comment: Ah yea I think I moved it down, I put it back to try to minimize it. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org