sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arv...@apache.org
Subject svn commit: r1304026 - /incubator/sqoop/trunk/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
Date Thu, 22 Mar 2012 20:20:28 GMT
Author: arvind
Date: Thu Mar 22 20:20:27 2012
New Revision: 1304026

URL: http://svn.apache.org/viewvc?rev=1304026&view=rev
Log:
SQOOP-464. Warn when user is importing data into /user/hive/warehouse with flag --hive-import.

(Jarek Jarcec Cecho via Arvind Prabhakar)

Modified:
    incubator/sqoop/trunk/src/java/org/apache/sqoop/tool/BaseSqoopTool.java

Modified: incubator/sqoop/trunk/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
URL: http://svn.apache.org/viewvc/incubator/sqoop/trunk/src/java/org/apache/sqoop/tool/BaseSqoopTool.java?rev=1304026&r1=1304025&r2=1304026&view=diff
==============================================================================
--- incubator/sqoop/trunk/src/java/org/apache/sqoop/tool/BaseSqoopTool.java (original)
+++ incubator/sqoop/trunk/src/java/org/apache/sqoop/tool/BaseSqoopTool.java Thu Mar 22 20:20:27
2012
@@ -938,6 +938,25 @@ public abstract class BaseSqoopTool exte
               + " option conflicts with the " + HIVE_DELIMS_REPLACEMENT_ARG
               + " option." + HELP_STR);
     }
+    // Many users are reporting issues when they are trying to import data
+    // directly into hive warehouse. This should prevent users from doing
+    // so in case of a default location.
+    String defaultHiveWarehouse = "/user/hive/warehouse";
+    if (options.doHiveImport()
+      && ((
+        options.getWarehouseDir() != null
+        && options.getWarehouseDir().startsWith(defaultHiveWarehouse)
+        ) || (
+        options.getTargetDir() != null
+        && options.getTargetDir().startsWith(defaultHiveWarehouse)
+    ))) {
+      LOG.warn("It seems that you're doing hive import directly into default");
+      LOG.warn("hive warehouse directory which is not supported. Sqoop is");
+      LOG.warn("firstly importing data into separate directory and then");
+      LOG.warn("inserting data into hive. Please consider removing");
+      LOG.warn("--target-dir or --warehouse-dir into /user/hive/warehouse in");
+      LOG.warn("case that you will detect any issues.");
+    }
   }
 
   protected void validateHBaseOptions(SqoopOptions options)



Mime
View raw message