lirui-apache commented on code in PR #15276:
URL: https://github.com/apache/iceberg/pull/15276#discussion_r2787653194
##########
core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java:
##########
@@ -1752,6 +1752,82 @@ public void testEntriesTableEstimateSize() throws
Exception {
assertEstimatedRowCount(new AllEntriesTable(table), 4);
}
+ @TestTemplate
+ public void testMetadataTableScansOnBranch() throws IOException {
+ table.newFastAppend().appendFile(FILE_A).commit();
+ table.manageSnapshots().createBranch("testBranch").commit();
+ table.newFastAppend().appendFile(FILE_B).commit();
+
+ Table entriesTable = new ManifestEntriesTable(table);
+ assertThat(
+ rowCount(
+ entriesTable
+ .newScan()
+ .useRef("testBranch")
+ .select("status")
+
.filter(Expressions.lessThan("data_file.partition.data_bucket", 0))))
+ .as("ManifestEntriesTable on branch should have no entry satisfying
the filter")
+ .isEqualTo(0);
+ assertThat(rowCount(entriesTable.newScan()))
+ .as("ManifestEntriesTable on main should have 2 entries")
+ .isEqualTo(2);
+
+ Table dataFilesTable = new DataFilesTable(table);
+ assertThat(rowCount(dataFilesTable.newScan().useRef("testBranch")))
+ .as("DataFilesTable on branch should have 1 file")
+ .isEqualTo(1);
+ assertThat(rowCount(dataFilesTable.newScan()))
Review Comment:
I believe this will produce the same results for entries/files table. But
for ManifestsTable, both main and testBranch will have 1 scan task. Is that OK?
--
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]