diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 94e68b4..761375e 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -113,9 +113,10 @@ public class HiveConf extends Configuration { * */ public static enum ConfVars { + // WARNING: "null" is not an acceptable default value. Use "" instead! // 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 +147,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 +165,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 +324,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 +469,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", @@ -670,7 +673,7 @@ public class HiveConf extends Configuration { } } - public HiveConf() { + private HiveConf() { super(); } @@ -710,18 +713,16 @@ public class HiveConf extends Configuration { // preserve the original configuration origProp = getUnderlyingProps(); + // Apply the default configuration values listed above + applyDefaultConfVars(); + // let's add the hive configuration - URL hconfurl = getClassLoader().getResource("hive-default.xml"); - if (hconfurl == null) { - l4j.debug("hive-default.xml not found."); - } else { - addResource(hconfurl); - } URL hsiteurl = getClassLoader().getResource("hive-site.xml"); if (hsiteurl == null) { - l4j.debug("hive-site.xml not found."); + l4j.warn("hive-site.xml not found."); } else { addResource(hsiteurl); + l4j.info("loaded hive-site.xml from " + hsiteurl.getPath()); } // if hadoop configuration files are already in our path - then define @@ -749,6 +750,24 @@ 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 void applySystemProperties() { for (ConfVars oneVar : ConfVars.values()) { if (System.getProperty(oneVar.varname) != null) { diff --git conf/hive-default.xml conf/hive-default.xml index 8b60e42..1c60a7a 100644 --- conf/hive-default.xml +++ conf/hive-default.xml @@ -19,11 +19,9 @@ - - - - - + + +