sunithabeeram commented on a change in pull request #3671:  Make different 
PinotFS concrete classes have the same behaviors
URL: https://github.com/apache/incubator-pinot/pull/3671#discussion_r246851045
 
 

 ##########
 File path: 
pinot-hadoop-filesystem/src/main/java/com/linkedin/pinot/filesystem/HadoopPinotFS.java
 ##########
 @@ -97,39 +109,93 @@ public boolean move(URI srcUri, URI dstUri, boolean 
overwrite) throws IOExceptio
    */
   @Override
   public boolean copy(URI srcUri, URI dstUri) throws IOException {
-    Path source = new Path(srcUri);
-    Path target = new Path(dstUri);
-    RemoteIterator<LocatedFileStatus> sourceFiles = 
_hadoopFS.listFiles(source, true);
-    if (sourceFiles != null) {
-      while (sourceFiles.hasNext()) {
-        boolean succeeded = FileUtil.copy(_hadoopFS, 
sourceFiles.next().getPath(), _hadoopFS, target, true, _hadoopConf);
-        if (!succeeded) {
-          return false;
+    if (!exists(srcUri)) {
+      LOGGER.warn("Source {} does not exist", srcUri);
+      return false;
+    }
+    if (srcUri.equals(dstUri)) {
+      LOGGER.info("Source {} and destination {} are the same.", srcUri, 
dstUri);
+      return true;
+    }
+    if (!dstUri.getRawPath().startsWith(srcUri.getRawPath()) && 
exists(dstUri)) {
 
 Review comment:
   Same concern as above with deleting dst if its a folder.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to