You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/09/02 17:50:18 UTC

[GitHub] [iceberg] szehon-ho commented on a change in pull request #2989: Flink: Fix flaky test TestFlinkTableSink

szehon-ho commented on a change in pull request #2989:
URL: https://github.com/apache/iceberg/pull/2989#discussion_r701301452



##########
File path: flink/src/test/java/org/apache/iceberg/flink/SimpleDataUtil.java
##########
@@ -259,4 +265,37 @@ public static StructLikeSet actualRowSet(Table table, Long snapshotId, String...
 
     return dataFiles;
   }
+
+  public static Map<Long, List<DataFile>> snapshotToDataFiles(
+      Table table)
+      throws IOException {
+    table.refresh();
+    Map<Long, List<DataFile>> res = Maps.newHashMap();

Review comment:
       Done

##########
File path: flink/src/test/java/org/apache/iceberg/flink/SimpleDataUtil.java
##########
@@ -259,4 +265,37 @@ public static StructLikeSet actualRowSet(Table table, Long snapshotId, String...
 
     return dataFiles;
   }
+
+  public static Map<Long, List<DataFile>> snapshotToDataFiles(
+      Table table)
+      throws IOException {
+    table.refresh();
+    Map<Long, List<DataFile>> res = Maps.newHashMap();
+    List<ManifestFile> manifestFiles = table.currentSnapshot().allManifests();

Review comment:
       Done

##########
File path: flink/src/test/java/org/apache/iceberg/flink/SimpleDataUtil.java
##########
@@ -259,4 +265,37 @@ public static StructLikeSet actualRowSet(Table table, Long snapshotId, String...
 
     return dataFiles;
   }
+
+  public static Map<Long, List<DataFile>> snapshotToDataFiles(
+      Table table)
+      throws IOException {
+    table.refresh();
+    Map<Long, List<DataFile>> res = Maps.newHashMap();
+    List<ManifestFile> manifestFiles = table.currentSnapshot().allManifests();
+    for (ManifestFile mf : manifestFiles) {
+      try (ManifestReader<DataFile> reader = ManifestFiles.read(mf, table.io())) {
+        List<DataFile> dataFiles = IteratorUtils.toList(reader.iterator());
+        if (res.containsKey(mf.snapshotId())) {
+          res.get(mf.snapshotId()).addAll(dataFiles);
+        } else {
+          res.put(mf.snapshotId(), dataFiles);
+        }
+      }
+    }
+    return res;
+  }
+
+  public static List<DataFile> matchingPartitions(
+      List<DataFile> dataFiles, PartitionSpec partitionSpec, Map<String, Object> partitionValues) {
+    Types.StructType spec = partitionSpec.partitionType();

Review comment:
       Done




-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org