RussellSpitzer commented on code in PR #12855:
URL: https://github.com/apache/iceberg/pull/12855#discussion_r2075753520
##########
data/src/test/java/org/apache/iceberg/data/DeleteReadTests.java:
##########
@@ -586,6 +595,94 @@ public void testEqualityDeleteByNull() throws IOException {
checkDeleteCount(1L);
}
+ @TestTemplate
+ public void testEqualityDeleteBinaryColumn() throws IOException {
+ List<Record> allRecords = appendOptionalColumnRecords();
+
+ Record binaryDataDelete =
GenericRecord.create(table.schema().select("binaryData"));
+ List<Record> equalityDeletes =
+ Lists.newArrayList(
+ binaryDataDelete.copy("binaryData",
ByteBuffer.wrap(("binaryData_0").getBytes())),
+ binaryDataDelete.copy("binaryData",
ByteBuffer.wrap(("binaryData_1").getBytes())),
+ binaryDataDelete.copy("binaryData",
ByteBuffer.wrap(("binaryData_2").getBytes())));
+ StructLikeSet expected = rowSetWithoutIds(table, allRecords, 200, 201,
202);
+ testEqualityDeletes(equalityDeletes, expected);
+ }
+
+ @TestTemplate
+ public void testEqualityDeleteStructColumn() throws IOException {
+ List<Record> allRecords = appendOptionalColumnRecords();
+
+ Record structDataDelete =
GenericRecord.create(table.schema().select("structData"));
+ Record structRecord0 =
+
GenericRecord.create(table.schema().findType("structData").asStructType());
+ Record structRecord1 =
+
GenericRecord.create(table.schema().findType("structData").asStructType());
+ Record structRecord2 =
+
GenericRecord.create(table.schema().findType("structData").asStructType());
+ structRecord0.setField("structInnerData", "structInnerData_0");
+ structRecord1.setField("structInnerData", "structInnerData_1");
+ structRecord2.setField("structInnerData", "structInnerData_2");
+ List<Record> equalityDeletes =
+ Lists.newArrayList(
+ structDataDelete.copy("structData", structRecord0),
+ structDataDelete.copy("structData", structRecord1),
+ structDataDelete.copy("structData", structRecord2));
+ StructLikeSet expected = rowSetWithoutIds(table, allRecords, 200, 201,
202);
+ testEqualityDeletes(equalityDeletes, expected);
+ }
+
+ private void testEqualityDeletes(List<Record> equalityDeletes, StructLikeSet
expected)
+ throws IOException {
+ if (equalityDeletes.isEmpty()) {
+ throw new IllegalArgumentException("Expected equality deletes in
testEqualityDeletes");
+ }
+ DeleteFile eqDeletes =
+ FileHelpers.writeDeleteFile(
+ table,
+ Files.localOutput(File.createTempFile("junit", null,
temp.toFile())),
+ Row.of(0),
+ equalityDeletes,
+ equalityDeletes.get(0).struct().asSchema());
+ table.newRowDelta().addDeletes(eqDeletes).commit();
+
+ StructLikeSet actual = rowSet(tableName, table, "*");
+ assertThat(actual).as("Table should contain expected
rows").isEqualTo(expected);
+ checkDeleteCount(equalityDeletes.size());
+ }
+
+ private List<Record> appendOptionalColumnRecords() throws IOException {
Review Comment:
Not sure on the name here? Why are they optional?
--
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]