Index: ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java (revision 1160551) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java (working copy) @@ -77,6 +77,9 @@ fs.delete(targetPath, true); // if source exists, rename. Otherwise, create a empty directory if (fs.exists(sourcePath)) { + // If it multiple level of folder are there fs.rename is failing so first + // create the targetpath + fs.mkdirs(targetPath); if (!fs.rename(sourcePath, targetPath)) { throw new HiveException("Unable to rename: " + sourcePath + " to: " + targetPath);