@Test public void testConfProperties() throws Exception { // Make sure null-valued ConfVar properties do not override the Hadoop Configuration // NOTE: Comment out the following test case for now until a better way to test is found, // as this test case cannot be reliably tested. The reason for this is that Hive does // overwrite fs.default.name in HiveConf if the property is set in system properties. // checkHadoopConf(ConfVars.HADOOPFS.varname, "core-site.xml"); // checkConfVar(ConfVars.HADOOPFS, null); // checkHiveConf(ConfVars.HADOOPFS.varname, "core-site.xml"); // Make sure non-null-valued ConfVar properties *do* override the Hadoop Configuration checkHadoopConf(ConfVars.HADOOPNUMREDUCERS.varname, "1"); checkConfVar(ConfVars.HADOOPNUMREDUCERS, "-1"); checkHiveConf(ConfVars.HADOOPNUMREDUCERS.varname, "-1"); // Non-null ConfVar only defined in ConfVars checkHadoopConf(ConfVars.HIVESKEWJOINKEY.varname, null); checkConfVar(ConfVars.HIVESKEWJOINKEY, "100000"); checkHiveConf(ConfVars.HIVESKEWJOINKEY.varname, "100000"); // ConfVar overridden in in hive-site.xml checkHadoopConf(ConfVars.HIVETESTMODEDUMMYSTATAGGR.varname, null); checkConfVar(ConfVars.HIVETESTMODEDUMMYSTATAGGR, ""); checkHiveConf(ConfVars.HIVETESTMODEDUMMYSTATAGGR.varname, "value2"); // Property defined in hive-site.xml only checkHadoopConf("test.property1", null); checkHiveConf("test.property1", "value1"); // Test HiveConf property variable substitution in hive-site.xml checkHiveConf("test.var.hiveconf.property", ConfVars.DEFAULTPARTITIONNAME.getDefaultValue()); }