Blazer-007 commented on code in PR #4058:
URL: https://github.com/apache/gobblin/pull/4058#discussion_r1812489697


##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/iceberg/IcebergPartitionDataset.java:
##########
@@ -183,16 +187,20 @@ private Path addUUIDToPath(String filePathStr) {
     return new Path(fileDir, newFileName);
   }
 
-  private Map<Path, FileStatus> 
getDestFilePathWithSrcFileStatus(List<DataFile> srcDataFiles,
-      List<DataFile> destDataFiles, FileSystem fs) throws IOException {
-    Map<Path, FileStatus> results = Maps.newHashMap();
-    for (int i = 0; i < srcDataFiles.size(); i++) {
-      Path srcPath = new Path(srcDataFiles.get(i).path().toString());
-      Path destPath = new Path(destDataFiles.get(i).path().toString());
-      FileStatus srcFileStatus = fs.getFileStatus(srcPath);
-      results.put(destPath, srcFileStatus);
-    }
-    return results;
+  private Map<Path, FileStatus> calcSrcFileStatusByDestFilePath(Map<Path, 
DataFile> destDataFileBySrcPath) {
+    Map<Path, FileStatus> srcFileStatusByDestFilePath = Maps.newHashMap();
+    destDataFileBySrcPath.forEach((srcPath, destDataFile) -> {
+      FileStatus srcFileStatus;
+      try {
+        srcFileStatus = this.sourceFs.getFileStatus(srcPath);
+      } catch (IOException e) {
+        String errMsg = String.format("~%s~ Failed to get file status for path 
: %s", this.getFileSetId(), srcPath);
+        log.error(errMsg);
+        throw new RuntimeException(errMsg, e);
+      }

Review Comment:
   Done using [IcebergDataset's 
use](https://github.com/apache/gobblin/blob/af4b822a1e2f79721cdff617f1581e77ff261580/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/iceberg/IcebergDataset.java#L205)
 of 
[CheckedExceptionFunction.wrapToTunneled](https://github.com/apache/gobblin/blob/585298fb5ebc074f69c1b9db87de6186c4855b26/gobblin-utility/src/main/java/org/apache/gobblin/util/function/CheckedExceptionFunction.java#L69)



-- 
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: dev-unsubscr...@gobblin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to