commit 122f80d7e300c32ff5782461fe3aded0a1da7a16 Author: Reuben Kuhnert Date: Tue Mar 8 11:26:41 2016 -0600 HIVE-13231: Show helpful message when create as location fails because parent directory does not exist. Change-Id: Idb5dabba4f93facfa00927d5732bc74a25671d98 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 ad170963c4044bdf71e3d498cab669014e452ab3..0268dbd55c84a6a5762751f52aafdab05e32745b 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 @@ -2798,7 +2798,15 @@ public static boolean moveFile(HiveConf conf, Path srcf, Path destf, LOG.info((replace ? "Replacing src:" : "Renaming src: ") + srcf.toString() + ", dest: " + destf.toString() + ", Status:" + success); } catch (IOException ioe) { - throw new HiveException("Unable to move source " + srcf + " to destination " + destf, ioe); + StringBuilder message = new StringBuilder( + String.format("Unable to move source %s to destination %s. ", srcf, destf) + ); + + if (!HiveConf.getBoolVar(conf, ConfVars.HIVE_INSERT_INTO_MULTILEVEL_DIRS)) { + message.append("To enable automatic subdirectory generation set 'hive.insert.into.multilevel.dirs=true'."); + } + + throw new HiveException(message.toString(), ioe); } if (success && inheritPerms) {