diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java index 78ea21d..4a60f52 100644 --- a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java +++ b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java @@ -103,6 +103,7 @@ public static final String UTF_8 = "UTF-8"; private static final Log LOG = LogFactory.getLog("QTestUtil"); + private static final String QTEST_LEAVE_FILES = "QTEST_LEAVE_FILES"; private final String defaultInitScript = "q_test_init.sql"; private final String defaultCleanupScript = "q_test_cleanup.sql"; @@ -537,6 +538,9 @@ public void clearPostTestEffects() throws Exception { * Clear out any side effects of running tests */ public void clearTestSideEffects() throws Exception { + if (System.getenv(QTEST_LEAVE_FILES) != null) { + return; + } // Delete any tables other than the source tables // and any databases other than the default database. for (String dbName : db.getAllDatabases()) { @@ -598,6 +602,9 @@ public void cleanUp() throws Exception { if(!isSessionStateStarted) { startSessionState(); } + if (System.getenv(QTEST_LEAVE_FILES) != null) { + return; + } SessionState.get().getConf().setBoolean("hive.test.shutdown.phase", true);