anoopj commented on code in PR #18884:
URL: https://github.com/apache/iceberg/pull/18884#discussion_r4569264510
##########
core/src/main/java/org/apache/iceberg/SnapshotScan.java:
##########
@@ -185,6 +186,37 @@ public Snapshot snapshot() {
return snapshotId() != null ? table().snapshot(snapshotId()) :
table().currentSnapshot();
}
+ /** Plans file scan tasks for a snapshot that references a v4 root manifest.
*/
+ CloseableIterable<FileScanTask> planV4RootManifest(Snapshot snapshot) {
+ ManifestFile root = RootManifestFile.from(snapshot, table().io(),
table().location());
+ FilePlanner planner =
+ new FilePlanner(table().io(), root, tableSchema(), specs())
+ .filterData(filter())
+ .caseSensitive(isCaseSensitive())
+ .scanMetrics(scanMetrics())
+ .tableLocation(table().location())
+ .planWith(shouldPlanWithExecutor() ? planExecutor() : null);
+
+ if (shouldIgnoreResiduals()) {
+ planner.ignoreResiduals();
+ }
+
+ if (shouldReturnColumnStats()) {
+ planner.projectStats(statsColumnIds());
+ }
+
+ return planner.planFiles();
+ }
+
+ private int[] statsColumnIds() {
+ Set<Integer> columns = columnsToKeepStats();
+ if (columns == null) {
+ columns = TypeUtil.getProjectedIds(tableSchema());
Review Comment:
BTW there was no bug in the old code, because we were doing
```java
if (shouldReturnColumnStats()) {
planner.projectStats(statsColumnIds());
}
```
But agree that it reads a bit fragile, so I have inlined 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: [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]