szehon-ho commented on code in PR #8132:
URL: https://github.com/apache/iceberg/pull/8132#discussion_r1272576470
##########
core/src/main/java/org/apache/iceberg/deletes/Deletes.java:
##########
@@ -293,15 +310,53 @@ private static class PositionStreamDeleteMarker<T>
extends PositionStreamDeleteI
}
@Override
- protected CloseableIterator<T> applyDelete(CloseableIterator<T> items) {
- return CloseableIterator.transform(
- items,
- row -> {
- if (isDeleted(row)) {
- markDeleted.accept(row);
+ protected CloseableIterator<T> applyDelete(
+ CloseableIterator<T> items, CloseableIterator<Long> deletePositions) {
+
+ return new CloseableIterator<T>() {
Review Comment:
Note: the point of this additional code is to have parity with the other
applyDelete method.
The other one returns a FilterIterator, which auto-closes, as mentioned in
description.
##########
core/src/main/java/org/apache/iceberg/deletes/Deletes.java:
##########
@@ -293,15 +310,53 @@ private static class PositionStreamDeleteMarker<T>
extends PositionStreamDeleteI
}
@Override
- protected CloseableIterator<T> applyDelete(CloseableIterator<T> items) {
- return CloseableIterator.transform(
- items,
- row -> {
- if (isDeleted(row)) {
- markDeleted.accept(row);
+ protected CloseableIterator<T> applyDelete(
+ CloseableIterator<T> items, CloseableIterator<Long> deletePositions) {
+
+ return new CloseableIterator<T>() {
+
+ private boolean closed = false;
+
+ @Override
+ public void close() {
+ if (!closed) {
+ try {
+ deletePositions.close();
+ } catch (IOException ignore) {
+ LOG.warn("Error closing delete file", ignore);
}
- return row;
- });
+ try {
+ items.close();
+ } catch (IOException ignore) {
+ LOG.warn("Error closing data file", ignore);
+ }
+ closed = true;
+ }
+ }
+
+ @Override
+ public boolean hasNext() {
Review Comment:
Note: the point of this additional code is to have parity with the other
applyDelete method.
The other one returns a FilterIterator, which auto-closes, as mentioned in
description.
--
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]