pvary commented on code in PR #18338:
URL: https://github.com/apache/iceberg/pull/18338#discussion_r4511386432


##########
core/src/test/java/org/apache/iceberg/TestDeleteFiles.java:
##########
@@ -470,6 +471,59 @@ public void testDeleteWithCollision() {
     assertThat(afterDeletePartitions).containsExactly(partitionOne);
   }
 
+  @TestTemplate
+  public void 
deleteFromRowFilterKeepsEqualityDeleteWithMisleadingNonKeyColumnStats() {
+    Schema schema =
+        new Schema(
+            Types.NestedField.required(3, "id", Types.IntegerType.get()),
+            Types.NestedField.required(4, "data", Types.StringType.get()));
+    int eqDeleteFormatVersion = Math.min(Math.max(formatVersion, 2), 3);
+    Table eqDeleteTable =
+        TestTables.create(
+            tableDir,
+            "eq-delete-row-filter",
+            schema,
+            PartitionSpec.unpartitioned(),
+            eqDeleteFormatVersion);
+
+    int idFieldId = eqDeleteTable.schema().findField("id").fieldId();
+    int dataFieldId = eqDeleteTable.schema().findField("data").fieldId();
+
+    DeleteFile eqDeletes =
+        FileMetadata.deleteFileBuilder(PartitionSpec.unpartitioned())
+            .ofEqualityDeletes(idFieldId)
+            .withPath("/path/to/eq-delete.parquet")
+            .withFileSizeInBytes(10)
+            .withRecordCount(1)
+            .withMetrics(
+                new Metrics(
+                    1L,
+                    null, // no column sizes
+                    ImmutableMap.of(idFieldId, 1L, dataFieldId, 1L), // value 
counts
+                    ImmutableMap.of(idFieldId, 0L, dataFieldId, 0L), // null 
counts
+                    null, // no nan value counts
+                    ImmutableMap.of(
+                        dataFieldId, 
Conversions.toByteBuffer(Types.StringType.get(), "zzz")),
+                    ImmutableMap.of(
+                        dataFieldId, 
Conversions.toByteBuffer(Types.StringType.get(), "zzz"))))
+            .build();
+    eqDeleteTable.newRowDelta().addDeletes(eqDeletes).commit();
+    Snapshot addSnapshot = eqDeleteTable.currentSnapshot();
+
+    eqDeleteTable.newDelete().deleteFromRowFilter(Expressions.equal("data", 
"zzz")).commit();
+
+    // the delete manifest is untouched: the filter can only reach the non-key 
"data" stats,

Review Comment:
   nit: extra `,`



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