From 885248536aff43b91a8c933e94468430cdc0c8a1 Mon Sep 17 00:00:00 2001 From: Arvind Prabhakar Date: Thu, 22 Mar 2012 20:20:27 +0000 Subject: [PATCH] SQOOP-464. Warn when user is importing data into /user/hive/warehouse with flag --hive-import. (Jarek Jarcec Cecho via Arvind Prabhakar) git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1304026 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/sqoop/tool/BaseSqoopTool.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/java/org/apache/sqoop/tool/BaseSqoopTool.java b/src/java/org/apache/sqoop/tool/BaseSqoopTool.java index 64769269..e58cacfc 100644 --- a/src/java/org/apache/sqoop/tool/BaseSqoopTool.java +++ b/src/java/org/apache/sqoop/tool/BaseSqoopTool.java @@ -938,6 +938,25 @@ protected void validateHiveOptions(SqoopOptions options) + " 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)