diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 94e68b4..5c84353 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -114,8 +114,8 @@ public class HiveConf extends Configuration { */ public static enum ConfVars { // QL execution stuff - SCRIPTWRAPPER("hive.exec.script.wrapper", null), - PLAN("hive.exec.plan", null), + SCRIPTWRAPPER("hive.exec.script.wrapper", ""), + PLAN("hive.exec.plan", ""), SCRATCHDIR("hive.exec.scratchdir", "/tmp/hive-" + System.getProperty("user.name")), SUBMITVIACHILD("hive.exec.submitviachild", false), SCRIPTERRORLIMIT("hive.exec.script.maxerrsize", 100000), @@ -146,7 +146,7 @@ public class HiveConf extends Configuration { SHOW_JOB_FAIL_DEBUG_INFO("hive.exec.show.job.failure.debug.info", true), JOB_DEBUG_TIMEOUT("hive.exec.job.debug.timeout", 30000), TASKLOG_DEBUG_TIMEOUT("hive.exec.tasklog.debug.timeout", 20000), - OUTPUT_FILE_EXTENSION("hive.output.file.extension", null), + OUTPUT_FILE_EXTENSION("hive.output.file.extension", ""), // should hive determine whether to run in local mode automatically ? LOCALMODEAUTO("hive.exec.mode.local.auto", false), @@ -164,12 +164,12 @@ public class HiveConf extends Configuration { HADOOPBIN("hadoop.bin.path", System.getenv("HADOOP_HOME") + "/bin/hadoop"), HADOOPCONF("hadoop.config.dir", System.getenv("HADOOP_HOME") + "/conf"), HADOOPFS("fs.default.name", "file:///"), - HADOOPMAPFILENAME("map.input.file", null), - HADOOPMAPREDINPUTDIR("mapred.input.dir", null), + HADOOPMAPFILENAME("map.input.file", ""), + HADOOPMAPREDINPUTDIR("mapred.input.dir", ""), HADOOPMAPREDINPUTDIRRECURSIVE("mapred.input.dir.recursive", false), HADOOPJT("mapred.job.tracker", "local"), HADOOPNUMREDUCERS("mapred.reduce.tasks", -1), - HADOOPJOBNAME("mapred.job.name", null), + HADOOPJOBNAME("mapred.job.name", ""), HADOOPSPECULATIVEEXECREDUCERS("mapred.reduce.tasks.speculative.execution", false), // Metastore stuff. Be sure to update HiveConf.metaVars when you add @@ -323,7 +323,9 @@ public class HiveConf extends Configuration { // HWI HIVEHWILISTENHOST("hive.hwi.listen.host", "0.0.0.0"), HIVEHWILISTENPORT("hive.hwi.listen.port", "9999"), - HIVEHWIWARFILE("hive.hwi.war.file", System.getenv("HWI_WAR_FILE")), + HIVEHWIWARFILE("hive.hwi.war.file", + (System.getenv("HWI_WAR_FILE") != null) ? + System.getenv("HWI_WAR_FILE") : ""), // mapper/reducer memory in local mode HIVEHADOOPMAXMEM("hive.mapred.local.mem", 0), @@ -466,7 +468,7 @@ public class HiveConf extends Configuration { // Hive Variables HIVEVARIABLESUBSTITUTE("hive.variable.substitute", true), - SEMANTIC_ANALYZER_HOOK("hive.semantic.analyzer.hook",null), + SEMANTIC_ANALYZER_HOOK("hive.semantic.analyzer.hook", ""), HIVE_AUTHORIZATION_ENABLED("hive.security.authorization.enabled", false), HIVE_AUTHORIZATION_MANAGER("hive.security.authorization.manager", @@ -710,6 +712,8 @@ public class HiveConf extends Configuration { // preserve the original configuration origProp = getUnderlyingProps(); + applyDefaultConfVars(); + // let's add the hive configuration URL hconfurl = getClassLoader().getResource("hive-default.xml"); if (hconfurl == null) { @@ -759,6 +763,25 @@ public class HiveConf extends Configuration { } } + public void applyDefaultConfVars() { + for (ConfVars var : ConfVars.values()) { + if (String.class.equals(var.valClass)) { + this.set(var.varname, var.defaultVal); + } else if (Integer.class.equals(var.valClass)) { + this.setInt(var.varname, var.defaultIntVal); + } else if (Long.class.equals(var.valClass)) { + this.setLong(var.varname, var.defaultLongVal); + } else if (Float.class.equals(var.valClass)) { + this.setFloat(var.varname, var.defaultFloatVal); + } else if (Boolean.class.equals(var.valClass)) { + this.setBoolean(var.varname, var.defaultBoolVal); + } else { + l4j.warn("Unable to set default configuration value for " + var.varname); + } + } + } + + public Properties getChangedProperties() { Properties ret = new Properties(); Properties newProp = getUnderlyingProps();