amogh-jahagirdar commented on code in PR #15276:
URL: https://github.com/apache/iceberg/pull/15276#discussion_r2785940401


##########
core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java:
##########
@@ -1752,6 +1752,84 @@ 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(
+            rowsCount(
+                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(rowsCount(entriesTable.newScan()))
+        .as("ManifestEntriesTable on main should have 2 entries")
+        .isEqualTo(2);
+
+    Table dataFilesTable = new DataFilesTable(table);
+    assertThat(rowsCount(dataFilesTable.newScan().useRef("testBranch")))
+        .as("DataFilesTable on branch should have 1 file")
+        .isEqualTo(1);
+    assertThat(rowsCount(dataFilesTable.newScan()))
+        .as("DataFilesTable on main should have 2 files")
+        .isEqualTo(2);
+
+    Table manifestsTable = new ManifestsTable(table);
+    assertThat(rowsCount(manifestsTable.newScan().useRef("testBranch")))
+        .as("ManifestsTable on branch should have 1 manifest")
+        .isEqualTo(1);
+    assertThat(rowsCount(manifestsTable.newScan()))
+        .as("ManifestsTable on main should have 2 manifests")
+        .isEqualTo(2);
+
+    Table filesTable = new FilesTable(table);
+    assertThat(rowsCount(filesTable.newScan().useRef("testBranch")))
+        .as("FilesTable on branch should have 1 file")
+        .isEqualTo(1);
+    assertThat(rowsCount(filesTable.newScan()))
+        .as("FilesTable on main should have 2 files")
+        .isEqualTo(2);
+  }
+
+  @TestTemplate
+  public void testDeleteFilesTableScanOnBranch() throws IOException {
+    assumeThat(formatVersion).as("Delete files are not supported by V1 
Tables").isGreaterThan(1);
+
+    table.newFastAppend().appendFile(FILE_A).commit();
+    table.newRowDelta().addDeletes(fileADeletes()).commit();
+    table.manageSnapshots().createBranch("testBranch").commit();
+
+    table.newFastAppend().appendFile(FILE_B).commit();
+    table.newRowDelta().addDeletes(fileBDeletes()).commit();
+
+    Table deleteFilesTable = new DeleteFilesTable(table);
+    assertThat(rowsCount(deleteFilesTable.newScan().useRef("testBranch")))
+        .as("DeleteFilesTable on branch should have 1 delete file")
+        .isEqualTo(1);
+    assertThat(rowsCount(deleteFilesTable.newScan()))
+        .as("DeleteFilesTable on main should have 2 delete files")
+        .isEqualTo(2);
+  }
+
+  private int rowsCount(TableScan scan) throws IOException {

Review Comment:
   Minor: rowsCount -> rowCount



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