sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-2024: Hive import doesn't remove target directory in hive
Date Sat, 24 Jan 2015 01:29:14 GMT
Repository: sqoop
Updated Branches:
  refs/heads/trunk 41d8ca272 -> 6e555218f


SQOOP-2024: Hive import doesn't remove target directory in hive

(Abraham Elmahrek via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/6e555218
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/6e555218
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/6e555218

Branch: refs/heads/trunk
Commit: 6e555218fbe189b1cfe84f59200b8835f7ba39b1
Parents: 41d8ca2
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Fri Jan 23 17:28:48 2015 -0800
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Fri Jan 23 17:28:48 2015 -0800

----------------------------------------------------------------------
 src/java/org/apache/sqoop/hive/HiveImport.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/6e555218/src/java/org/apache/sqoop/hive/HiveImport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/hive/HiveImport.java b/src/java/org/apache/sqoop/hive/HiveImport.java
index 07a354b..097d622 100644
--- a/src/java/org/apache/sqoop/hive/HiveImport.java
+++ b/src/java/org/apache/sqoop/hive/HiveImport.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.mapred.FileOutputCommitter;
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.hadoop.util.Shell;
 import org.apache.hadoop.util.ToolRunner;
@@ -273,6 +274,9 @@ public class HiveImport {
         if (statuses.length == 0) {
           LOG.info("Export directory is empty, removing it.");
           fs.delete(outputPath, true);
+        } else if (statuses.length == 1 && statuses[0].getPath().getName().equals(FileOutputCommitter.SUCCEEDED_FILE_NAME))
{
+          LOG.info("Export directory is contains the _SUCCESS file only, removing the directory.");
+          fs.delete(outputPath, true);
         } else {
           LOG.info("Export directory is not empty, keeping it.");
         }


Mime
View raw message