sankarh commented on a change in pull request #624: HIVE-21717 : Rename is 
failing for directory in move task
URL: https://github.com/apache/hive/pull/624#discussion_r283185384
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
 ##########
 @@ -4301,6 +4301,19 @@ public void recycleDirToCmPath(Path dataPath, boolean 
isPurge) throws HiveExcept
     }
   }
 
+  private static void deleteAndRename(FileSystem destFs, Path destFile, 
FileStatus srcStatus, Path destPath)
+          throws IOException {
+    if (destFs.exists(destFile)) {
+      // rename cannot overwrite non empty destination directory, so deleting 
the destination before renaming.
+      destFs.delete(destFile);
+      LOG.info("Deleting destination file" + destFile.toUri());
+    }
+    if(!destFs.rename(srcStatus.getPath(), destFile)) {
+      throw new IOException("rename for src path: " + srcStatus.getPath() + " 
to dest:"
+              + destPath + " returned false");
 
 Review comment:
   OK, but dest should be destFile not destPath. 

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