Index: ql/src/java/org/apache/hadoop/hive/ql/Driver.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/Driver.java (revision 1057541) +++ ql/src/java/org/apache/hadoop/hive/ql/Driver.java (working copy) @@ -34,6 +34,7 @@ import java.util.Map; import java.util.Queue; import java.util.Set; +import java.util.Map.Entry; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -798,7 +799,6 @@ SessionState.get().getHiveHistory().setIdToTableMap(plan.getIdToTableNameMap()); } String jobname = Utilities.abbreviate(queryStr, maxlen - 6); - // A runtime that launches runnable tasks as separate Threads through // TaskRunners // As soon as a task isRunnable, it is put in a queue @@ -855,7 +855,7 @@ SQLState = "08S01"; console.printError(errorMessage); if (running.size() != 0) { - taskCleanup(); + taskCleanup(running); } return 9; } @@ -1001,7 +1001,21 @@ // The non MR processes will be killed as well. System.exit(9); } + + /** + * Cleans up remaining tasks in case of failure + * + * @param running + */ + public void taskCleanup(Map running) { + Set> entrySet = running.entrySet(); + for (Entry entry : entrySet) { + TaskRunner value = entry.getValue(); + value.interrupt(); + } + } + /** * Polls running tasks to see if a task has ended. * Index: ql/src/test/queries/clientnegative/alter_exit.q =================================================================== --- ql/src/test/queries/clientnegative/alter_exit.q (revision 0) +++ ql/src/test/queries/clientnegative/alter_exit.q (revision 0) @@ -0,0 +1,4 @@ +CREATE TABLE SAMPLETABLE(IP STRING , showtime BIGINT ) partitioned by (ds string,ipz int) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\040' + +ALTER TABLE SAMPLETABLE add Partition(ds='sf') location '/user/hive/warehouse' Partition(ipz=100) location '/user/hive/warehouse' +