szehon-ho commented on code in PR #4847:
URL: https://github.com/apache/iceberg/pull/4847#discussion_r908108774
##########
spark/v2.4/spark/src/test/java/org/apache/iceberg/spark/source/TestIcebergSourceTablesBase.java:
##########
@@ -991,18 +1005,34 @@ public void testAllManifestsTable() {
Table manifestTable = loadTable(tableIdentifier, "all_manifests");
Dataset<Row> df1 = spark.createDataFrame(Lists.newArrayList(new
SimpleRecord(1, "a")), SimpleRecord.class);
- List<ManifestFile> manifests = Lists.newArrayList();
-
df1.select("id", "data").write()
.format("iceberg")
.mode("append")
.save(loadLocation(tableIdentifier));
- manifests.addAll(table.currentSnapshot().allManifests());
+ table.updateProperties()
+ .set(TableProperties.FORMAT_VERSION, "2")
+ .commit();
+
+ DataFile dataFile =
Iterables.getFirst(table.currentSnapshot().addedFiles(table.io()), null);
+ PartitionSpec dataFileSpec = table.specs().get(dataFile.specId());
+ StructLike dataFilePartition = dataFile.partition();
+
+ PositionDelete<InternalRow> delete = PositionDelete.create();
+ delete.set(dataFile.path(), 0L, null);
+
+ DeleteFile deleteFile = writePositionDeletes(table, dataFileSpec,
dataFilePartition, ImmutableList.of(delete));
+
+ table.newRowDelta()
+ .addDeletes(deleteFile)
+ .commit();
table.newDelete().deleteFromRowFilter(Expressions.alwaysTrue()).commit();
- manifests.addAll(table.currentSnapshot().allManifests());
+ Stream<Pair<Long, ManifestFile>> snapshotIdToManifests =
+ StreamSupport.stream(table.snapshots().spliterator(), false)
Review Comment:
Yea I usually do, but this one is just parallel and pretty common, so maybe
skip this time? Would be great if StreamSupport has a default value.
--
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]