gaborkaszab commented on code in PR #16125:
URL: https://github.com/apache/iceberg/pull/16125#discussion_r3420064808


##########
spark/v4.1/spark/src/test/java/org/apache/iceberg/spark/source/TestIcebergSourceTablesBase.java:
##########
@@ -1758,6 +1769,64 @@ public void testPartitionsTableDeleteStats() {
     }
   }
 
+  @Test
+  public void testPartitionsTableDvCount() {
+    TableIdentifier tableIdentifier = TableIdentifier.of("db", 
"partitions_dv_test");
+    Table table =
+        createTable(
+            tableIdentifier, SCHEMA, SPEC, 
ImmutableMap.of(TableProperties.FORMAT_VERSION, "3"));
+    Dataset<Row> df =
+        spark.createDataFrame(Lists.newArrayList(new SimpleRecord(1, "a")), 
SimpleRecord.class);
+    df.select("id", "data")
+        .write()
+        .format("iceberg")
+        .mode("append")
+        .save(loadLocation(tableIdentifier));
+    table.refresh();
+    DataFile dataFile = TestHelpers.dataFiles(table).get(0);
+    DeleteFile dvFile = FileGenerationUtil.generateDV(table, dataFile);
+    table.newRowDelta().addDeletes(dvFile).commit();
+    table.refresh();
+    List<Row> actual =
+        spark
+            .read()
+            .format("iceberg")
+            .load(loadLocation(tableIdentifier, "partitions"))
+            .collectAsList();
+    assertThat(actual).hasSize(1);
+    assertThat((int) actual.get(0).getAs("dv_count"))
+        .as("dv_count should be 1 after adding a DV")
+        .isEqualTo(1);
+
+    // add a second data file and DV to test dv_count = 2
+    Dataset<Row> df2 =

Review Comment:
   nit: similarly to other tests, I'd add both files at the beginning of the 
test when setting up the test table.



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