RussellSpitzer commented on code in PR #8169:
URL: https://github.com/apache/iceberg/pull/8169#discussion_r1282458758
##########
core/src/main/java/org/apache/iceberg/io/ResolvingFileIO.java:
##########
@@ -85,6 +93,44 @@ public void deleteFile(String location) {
io(location).deleteFile(location);
}
+ @Override
+ public void deleteFiles(Iterable<String> pathsToDelete) throws
BulkDeletionFailureException {
+ // peek at the first element to determine the type of FileIO
+ Iterator<String> originalIterator = pathsToDelete.iterator();
+ if (!originalIterator.hasNext()) {
+ return;
+ }
+
+ PeekingIterator<String> iterator =
Iterators.peekingIterator(originalIterator);
+ FileIO fileIO = io(iterator.peek());
+ if (!(fileIO instanceof SupportsPrefixOperations)) {
+ throw new UnsupportedOperationException(
+ "FileIO doesn't support bulk operations: " +
fileIO.getClass().getName());
+ }
+
+ ((SupportsBulkOperations) fileIO).deleteFiles(() -> iterator);
Review Comment:
We also should probably pass through the original iterable. Just in case
this is a closable 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.
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]