You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sp...@apache.org on 2015/09/28 18:49:33 UTC

hive git commit: Revert "HIVE-11940: "INSERT OVERWRITE" query is very slow because it creates one "distcp" per file to copy data from staging directory to target directory (Sergio Pena, reviewd by Ferdinand Xu)"

Repository: hive
Updated Branches:
  refs/heads/branch-1 bc6ed7c42 -> 00bee1313


Revert "HIVE-11940: "INSERT OVERWRITE" query is very slow because it creates one "distcp" per file to copy data from staging directory to target directory (Sergio Pena, reviewd by Ferdinand Xu)"

This reverts commit bc6ed7c425abf3731f42759c00a5c3bda1773cd0.


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/00bee131
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/00bee131
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/00bee131

Branch: refs/heads/branch-1
Commit: 00bee131320d5b59d3c9df62529706d483e64457
Parents: bc6ed7c
Author: Sergio Pena <se...@cloudera.com>
Authored: Mon Sep 28 11:47:47 2015 -0500
Committer: Sergio Pena <se...@cloudera.com>
Committed: Mon Sep 28 11:47:47 2015 -0500

----------------------------------------------------------------------
 .../apache/hadoop/hive/ql/metadata/Hive.java    | 25 ++++----------------
 1 file changed, 5 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/00bee131/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index db03d2e..a19dad3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -2621,31 +2621,16 @@ private void constructOneLBLocationMap(FileStatus fSta,
             if (srcs.length == 0) {
               success = true; // Nothing to move.
             }
-
-            /* Move files one by one because source is a subdirectory of destination */
             for (FileStatus status : srcs) {
-              Path destFile;
-
-              /* Append the source filename to the destination directory */
-              if (destFs.isDirectory(destf)) {
-                destFile = new Path(destf, status.getPath().getName());
-              } else {
-                destFile = destf;
-              }
+              success = FileUtils.copy(srcf.getFileSystem(conf), status.getPath(), destf.getFileSystem(conf), destf,
+                  true,     // delete source
+                  replace,  // overwrite destination
+                  conf);
 
-              // Destination should be replaced, so we delete it first
-              if (destFs.exists(destFile)) {
-                if (!destFs.delete(destFile, true)) {
-                  throw new HiveException(String.format("File to replace could not be deleted: %s", destFile));
-                }
-              }
-
-              if (!(destFs.rename(status.getPath(), destFile))) {
+              if (!success) {
                 throw new HiveException("Unable to move source " + status.getPath() + " to destination " + destf);
               }
             }
-
-            success = true;
           } else {
             success = fs.rename(srcf, destf);
           }