diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java index 54de320aaa..6f47056ca7 100644 --- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java +++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java @@ -176,6 +176,8 @@ static void internalBeforeClassSetup(Map additionalProperties, b hconf.set(HiveConf.ConfVars.METASTORE_RAW_STORE_IMPL.varname, "org.apache.hadoop.hive.metastore.InjectableBehaviourObjectStore"); hconf.setBoolVar(HiveConf.ConfVars.HIVEOPTIMIZEMETADATAQUERIES, true); + hconf.setBoolVar(HiveConf.ConfVars.HIVESTATSAUTOGATHER, true); + hconf.setBoolVar(HiveConf.ConfVars.HIVE_STATS_RELIABLE, true); System.setProperty(HiveConf.ConfVars.PREEXECHOOKS.varname, " "); System.setProperty(HiveConf.ConfVars.POSTEXECHOOKS.varname, " "); @@ -850,20 +852,20 @@ public void testIncrementalAdds() throws IOException { // Now, we load data into the tables, and see if an incremental // repl drop/load can duplicate it. - run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + dbName + ".unptned", driver); + run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + dbName + ".unptned", true, driver); verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver); run("CREATE TABLE " + dbName + ".unptned_late AS SELECT * from " + dbName + ".unptned", driver); verifySetup("SELECT * from " + dbName + ".unptned_late", unptn_data, driver); - run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + dbName + ".ptned PARTITION(b=1)", driver); + run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + dbName + ".ptned PARTITION(b=1)", true, driver); verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1, driver); - run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + dbName + ".ptned PARTITION(b=2)", driver); + run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + dbName + ".ptned PARTITION(b=2)", true, driver); verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2, driver); run("CREATE TABLE " + dbName + ".ptned_late(a string) PARTITIONED BY (b int) STORED AS TEXTFILE", driver); - run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + dbName + ".ptned_late PARTITION(b=1)", driver); + run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + dbName + ".ptned_late PARTITION(b=1)", true, driver); verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=1",ptn_data_1, driver); - run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + dbName + ".ptned_late PARTITION(b=2)", driver); + run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + dbName + ".ptned_late PARTITION(b=2)", true, driver); verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=2", ptn_data_2, driver); // Perform REPL-DUMP/LOAD diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java index 03f136bb60..ee0e52879a 100644 --- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java +++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java @@ -823,7 +823,7 @@ private void blockPartitionLocationChangesOnReplSource(Database db, Table tbl, // Do not allow changing location of a managed table as alter event doesn't capture the // new files list. So, it may cause data inconsistency. - if (ec.isSetProperties()) { + if ((ec != null) && ec.isSetProperties()) { String alterType = ec.getProperties().get(ALTER_TABLE_OPERATION_TYPE); if (alterType != null && alterType.equalsIgnoreCase(ALTERLOCATION) && tbl.getTableType().equalsIgnoreCase(TableType.MANAGED_TABLE.name())) { @@ -846,7 +846,7 @@ private void validateTableChangesOnReplSource(Database db, Table oldTbl, Table n // Do not allow changing location of a managed table as alter event doesn't capture the // new files list. So, it may cause data inconsistency. We do this whether or not strict // managed is true on the source cluster. - if (ec.isSetProperties()) { + if ((ec != null) && ec.isSetProperties()) { String alterType = ec.getProperties().get(ALTER_TABLE_OPERATION_TYPE); if (alterType != null && alterType.equalsIgnoreCase(ALTERLOCATION) && oldTbl.getTableType().equalsIgnoreCase(TableType.MANAGED_TABLE.name())) {