use of org.apache.hadoop.hive.cli.CliDriver in project hive by apache.
the class TestCLIAuthzSessionContext method beforeTest.
@BeforeClass
public static void beforeTest() throws Exception {
HiveConf conf = new HiveConf();
conf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER, MockedHiveAuthorizerFactory.class.getName());
conf.setVar(ConfVars.HIVE_AUTHENTICATOR_MANAGER, SessionStateUserAuthenticator.class.getName());
conf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true);
conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
// once SessionState for thread is set, CliDriver picks conf from it
CliSessionState ss = new CliSessionState(conf);
ss.err = System.err;
ss.out = System.out;
SessionState.start(ss);
TestCLIAuthzSessionContext.driver = new CliDriver();
}
use of org.apache.hadoop.hive.cli.CliDriver in project phoenix by apache.
the class HiveTestUtil method cleanUp.
public void cleanUp() throws Exception {
if (!isSessionStateStarted) {
startSessionState();
}
if (System.getenv(QTEST_LEAVE_FILES) != null) {
return;
}
clearTablesCreatedDuringTests();
SessionState.get().getConf().setBoolean("hive.test.shutdown.phase", true);
if (cleanupScript != "") {
String cleanupCommands = readEntireFileIntoString(new File(cleanupScript));
LOG.info("Cleanup (" + cleanupScript + "):\n" + cleanupCommands);
if (cliDriver == null) {
cliDriver = new CliDriver();
}
cliDriver.processLine(cleanupCommands);
}
SessionState.get().getConf().setBoolean("hive.test.shutdown.phase", false);
// delete any contents in the warehouse dir
Path p = new Path(testWarehouse);
FileSystem fs = p.getFileSystem(conf);
try {
FileStatus[] ls = fs.listStatus(p);
for (int i = 0; (ls != null) && (i < ls.length); i++) {
fs.delete(ls[i].getPath(), true);
}
} catch (FileNotFoundException e) {
// Best effort
}
FunctionRegistry.unregisterTemporaryUDF("test_udaf");
FunctionRegistry.unregisterTemporaryUDF("test_error");
}
use of org.apache.hadoop.hive.cli.CliDriver in project phoenix by apache.
the class HiveTestUtil method createSources.
public void createSources() throws Exception {
if (!isSessionStateStarted) {
startSessionState();
}
conf.setBoolean("hive.test.init.phase", true);
if (cliDriver == null) {
cliDriver = new CliDriver();
}
cliDriver.processLine("set test.data.dir=" + testFiles + ";");
conf.setBoolean("hive.test.init.phase", false);
}
Aggregations