rdblue commented on code in PR #6651: URL: https://github.com/apache/iceberg/pull/6651#discussion_r1085892442
########## spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/source/TestSparkDataWrite.java: ########## @@ -117,17 +127,18 @@ public void testBasicWrite() throws IOException { .format("iceberg") .option(SparkWriteOptions.WRITE_FORMAT, format.toString()) .mode(SaveMode.Append) + .option("branch", branch) .save(location.toString()); table.refresh(); - Dataset<Row> result = spark.read().format("iceberg").load(location.toString()); + Dataset<Row> result = spark.read().format("iceberg").option("branch", branch).load(location.toString()); List<SimpleRecord> actual = result.orderBy("id").as(Encoders.bean(SimpleRecord.class)).collectAsList(); Assert.assertEquals("Number of rows should match", expected.size(), actual.size()); Assert.assertEquals("Result rows should match", expected, actual); - for (ManifestFile manifest : table.currentSnapshot().allManifests(table.io())) { + for (ManifestFile manifest : table.snapshot(branch).allManifests(table.io())) { Review Comment: I think that this should add a method to fetch the snapshot differently. For cases where the commit was to `main`, `currentSnapshot()` should still be used to validate behavior has not changed. ```java public Snapshot latestSnapshot(Table table, String branch) { if ("main".equals(branch)) { return table.currentSnapshot(); } else { return table.snapshot(branch); } } ``` -- 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