SbloodyS commented on code in PR #10675:
URL: https://github.com/apache/dolphinscheduler/pull/10675#discussion_r915390535


##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/S3Utils.java:
##########
@@ -175,21 +175,30 @@ public String getFileName(ResourceType resourceType, 
String tenantCode, String f
     }
 
     @Override
-    public void download(String tenantCode, String srcFilePath, String 
dstFile, boolean deleteSource, boolean overwrite) throws IOException {
+    public void download(String tenantCode, String srcFilePath, String 
dstFilePath, boolean deleteSource, boolean overwrite) throws IOException {
+        File dstFile = new File(dstFilePath);
+        if (dstFile.exists() && !overwrite) {
+            logger.info("the destination path {} already exists, download 
operation will be ignored", dstFilePath);
+            return;
+        }
+        if (dstFile.isDirectory()) {
+            org.apache.commons.io.FileUtils.deleteDirectory(dstFile);
+        } else {
+            org.apache.commons.io.FileUtils.createParentDirectories(dstFile);
+        }

Review Comment:
   > > Could you keep this consistent with 
`org.apache.dolphinscheduler.common.utils.HadoopUtils#copyHdfsToLocal`?
   > 
   > The processing logic on both sides is different, and the return value type 
of the function is also different. I suggest that another PR can be opened for 
this.
   
   You only need to `overwrite` this part to be consistent. The rest can remain 
the same.



-- 
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]

Reply via email to