rdblue commented on a change in pull request #2320:
URL: https://github.com/apache/iceberg/pull/2320#discussion_r599992402
##########
File path: data/src/main/java/org/apache/iceberg/data/DeleteFilter.java
##########
@@ -137,11 +139,43 @@ protected long pos(T record) {
CloseableIterable.transform(CloseableIterable.concat(deleteRecords),
Record::copy),
deleteSchema.asStruct());
- filteredRecords = Deletes.filter(filteredRecords,
- record -> projectRow.wrap(asStructLike(record)), deleteSet);
+ Predicate<T> isInDeleteSet = record ->
deleteSet.contains(projectRow.wrap(asStructLike(record)));
+ isInDeleteSets.add(isInDeleteSet);
}
- return filteredRecords;
+ return isInDeleteSets;
+ }
+
+ public CloseableIterable<T> findEqualityDeleteRows(CloseableIterable<T>
records) {
+ // Predicate to test whether a row has been deleted by equality deletions.
+ Predicate<T> deletedRows = applyEqDeletes().stream()
+ .reduce(Predicate::or)
+ .orElse(t -> false);
+
+ Filter<T> deletedRowsFilter = new Filter<T>() {
+ @Override
+ protected boolean shouldKeep(T item) {
+ return deletedRows.test(item);
+ }
+ };
+ return deletedRowsFilter.filter(records);
+ }
+
+ private CloseableIterable<T> applyEqDeletes(CloseableIterable<T> records) {
+ // Predicate to test whether a row should be visible to user after
applying equality deletions.
+ Predicate<T> remainingRows = applyEqDeletes().stream()
Review comment:
If there are no delete predicates, then this should return the original
iterable.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]