nastra commented on code in PR #15276:
URL: https://github.com/apache/iceberg/pull/15276#discussion_r2787553676


##########
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:
   instead of using `rowCount` everywhere you should be able to replace this 
directly with 
   ```
   assertThat(dataFilesTable.newScan().planFiles())
           .as("DataFilesTable on main should have 2 files")
           .hasSize(2);
   ```



-- 
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]

Reply via email to