xloya commented on a change in pull request #3135:
URL: https://github.com/apache/iceberg/pull/3135#discussion_r714436234
##########
File path: data/src/test/java/org/apache/iceberg/data/DeleteReadTests.java
##########
@@ -125,6 +166,42 @@ public void testEqualityDeletes() throws IOException {
Assert.assertEquals("Table should contain expected rows", expected,
actual);
}
+ @Test
+ public void testEqualityDateDeletes() throws IOException {
+ initTable2();
+
+ Schema deleteRowSchema = table2.schema().select("*");
+ Record dataDelete = GenericRecord.create(deleteRowSchema);
+ List<Record> dataDeletes = Lists.newArrayList(
+ dataDelete.copy("dt", LocalDate.parse("2021-09-01"), "data", "a",
"id", 1),
+ dataDelete.copy("dt", LocalDate.parse("2021-09-02"), "data", "b",
"id", 2),
+ dataDelete.copy("dt", LocalDate.parse("2021-09-03"), "data", "c",
"id", 3)
+ );
+
+ DeleteFile eqDeletes = FileHelpers.writeDeleteFile(
+ table2, Files.localOutput(temp.newFile()), Row.of(0), dataDeletes,
deleteRowSchema);
+
+ table2.newRowDelta()
+ .addDeletes(eqDeletes)
+ .commit();
+
+ StructLikeSet expected = rowSetWithoutIds2(1, 2, 3);
+ StructLikeSet expectedSet =
StructLikeSet.create(table2.schema().asStruct());
+
+ Iterables.addAll(expectedSet, expected.stream()
+ .map(record -> new
InternalRecordWrapper(table2.schema().asStruct()).wrap(record))
+ .collect(Collectors.toList()));
+
+ StructLikeSet actual = rowSet(tableName2, table2, "*");
+ StructLikeSet actualSet = StructLikeSet.create(table2.schema().asStruct());
+
+ Iterables.addAll(actualSet, actual.stream()
+ .map(record -> new
InternalRecordWrapper(table2.schema().asStruct()).wrap(record))
+ .collect(Collectors.toList()));
Review comment:
@rdblue OK. The data returned by the original `rowSetWithoutIds()`method
of `DeleteReadTests` and the original `rowSet()` method of
`TestGenericReaderDeletes` is the `GenericRecord` class. And in
`TestFlinkInputFormatReaderDeletes` the `rowSet()` method returns
`RowDataWrapper`, in `TestSparkReaderDeletes` the `rowSet()` method returns
`SparkStructLike`.Calling the `Assert.assertEquals()` method will compare the
two `StructLikeSets`. If it is `DATE/TIMESTAMP` type of the data, it will throw
an exception of `Not a instance of Integer/Long`, so it needs to be converted
to the `InternalRecordWrapper` class for comparison
--
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]