rdblue commented on a change in pull request #3365:
URL: https://github.com/apache/iceberg/pull/3365#discussion_r735755404
##########
File path: flink/src/test/java/org/apache/iceberg/flink/SimpleDataUtil.java
##########
@@ -267,17 +268,28 @@ public static StructLikeSet actualRowSet(Table table,
Long snapshotId, String...
public static Map<Long, List<DataFile>> snapshotToDataFiles(Table table)
throws IOException {
table.refresh();
+
Map<Long, List<DataFile>> result = Maps.newHashMap();
- List<ManifestFile> manifestFiles = table.currentSnapshot().dataManifests();
- for (ManifestFile manifestFile : manifestFiles) {
- try (ManifestReader<DataFile> reader = ManifestFiles.read(manifestFile,
table.io())) {
- List<DataFile> dataFiles = Lists.newArrayList(reader);
- if (result.containsKey(manifestFile.snapshotId())) {
- result.get(manifestFile.snapshotId()).addAll(dataFiles);
- } else {
- result.put(manifestFile.snapshotId(), dataFiles);
- }
+ Snapshot current = table.currentSnapshot();
Review comment:
I think it would be better to modify the old code rather than traversing
snapshots and planning scans. All you need to do is to read the manifest
entries and add the data files to the map using each entry's snapshot ID
instead of the manifest's snapshot ID. You can use `ManifestGroup.entries` to
get the entries.
--
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]