dramaticlly commented on code in PR #10036: URL: https://github.com/apache/iceberg/pull/10036#discussion_r1847331597
########## spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/RichFileInfo.java: ########## @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.iceberg.spark.actions; + +public class RichFileInfo extends FileInfo { Review Comment: Instead of defining this, I am wondering if you can reuse the existing [`iceberg.io.FileInfo`](https://github.com/apache/iceberg/blob/c07f2aabc0a1d02f068ecf1514d2479c0fbdd3b0/api/src/main/java/org/apache/iceberg/io/FileInfo.java#L21) , with location, size and created timestamp. Alternatively, I do notice existing [`iceberg.spark.FileInfo`](https://github.com/apache/iceberg/blob/568940f5f85568868f3d75855fa72d17378271f3/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/actions/FileInfo.java#L4) only have path and type tho. Maybe also worth considering add one optional size ? ########## core/src/main/java/org/apache/iceberg/hadoop/HadoopFileIO.java: ########## @@ -193,6 +195,29 @@ public void deleteFiles(Iterable<String> pathsToDelete) throws BulkDeletionFailu } } + @Override + public void deleteFilesWithSummary(Iterable<FileInfoSummary> filesToDelete) + throws BulkDeletionFailureException { + AtomicInteger failureCount = new AtomicInteger(0); + AtomicLong failureFileSize = new AtomicLong(0); + Tasks.foreach(filesToDelete) + .executeWith(executorService()) + .retry(DELETE_RETRY_ATTEMPTS) + .stopRetryOn(FileNotFoundException.class) + .suppressFailureWhenFinished() + .onFailure( + (f, e) -> { + LOG.error("Failure during bulk delete on file: {} ", f.location(), e); + failureCount.incrementAndGet(); + failureFileSize.addAndGet(f.size()); + }) + .run(fileInfo -> deleteFile(fileInfo.location())); + + if (failureCount.get() != 0) { + throw new BulkDeletionFailureException(failureCount.get(), failureFileSize.get()); + } + } Review Comment: Do we really need this new method and override only in HadoopFileIO? I think we can extract the path from FileInfoSummary and use for deletion. The failureFileSize can be summed over failure path ########## api/src/main/java/org/apache/iceberg/io/FileInfoSummary.java: ########## @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.iceberg.io; + +public class FileInfoSummary { Review Comment: I believe this can be replaced with [iceberg.io.FileInfo](https://github.com/apache/iceberg/blob/c07f2aabc0a1d02f068ecf1514d2479c0fbdd3b0/api/src/main/java/org/apache/iceberg/io/FileInfo.java) -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org