use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.
the class CompactorOnTezTest method setupWithConf.
protected void setupWithConf(HiveConf hiveConf) throws Exception {
File f = new File(TEST_WAREHOUSE_DIR);
if (f.exists()) {
FileUtil.fullyDelete(f);
}
if (!(new File(TEST_WAREHOUSE_DIR).mkdirs())) {
throw new RuntimeException("Could not create " + TEST_WAREHOUSE_DIR);
}
hiveConf.setVar(HiveConf.ConfVars.PREEXECHOOKS, "");
hiveConf.setVar(HiveConf.ConfVars.POSTEXECHOOKS, "");
hiveConf.setVar(HiveConf.ConfVars.METASTOREWAREHOUSE, TEST_WAREHOUSE_DIR);
hiveConf.setVar(HiveConf.ConfVars.HIVEINPUTFORMAT, HiveInputFormat.class.getName());
hiveConf.setVar(HiveConf.ConfVars.HIVEFETCHTASKCONVERSION, "none");
MetastoreConf.setTimeVar(hiveConf, MetastoreConf.ConfVars.TXN_OPENTXN_TIMEOUT, 2, TimeUnit.SECONDS);
TestTxnDbUtil.setConfValues(hiveConf);
TestTxnDbUtil.cleanDb(hiveConf);
TestTxnDbUtil.prepDb(hiveConf);
conf = hiveConf;
// Use tez as execution engine for this test class
setupTez(conf);
msClient = new HiveMetaStoreClient(conf);
driver = DriverFactory.newDriver(conf);
SessionState.start(new CliSessionState(conf));
}
use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.
the class TestMetastoreClientSideAuthorizationProvider method setUp.
@Before
public void setUp() throws Exception {
System.setProperty(HiveConf.ConfVars.METASTORE_PRE_EVENT_LISTENERS.varname, "org.apache.hadoop.hive.ql.security.authorization.AuthorizationPreEventListener");
int port = MetaStoreTestUtils.startMetaStoreWithRetry();
clientHiveConf = new HiveConf(this.getClass());
// Turn on client-side authorization
clientHiveConf.setBoolVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED, true);
clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.varname, getAuthorizationProvider());
clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER.varname, InjectableDummyAuthenticator.class.getName());
clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_TABLE_OWNER_GRANTS.varname, "");
clientHiveConf.setVar(HiveConf.ConfVars.HIVEMAPREDMODE, "nonstrict");
clientHiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
clientHiveConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
clientHiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
clientHiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
clientHiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
ugi = Utils.getUGI();
SessionState.start(new CliSessionState(clientHiveConf));
msc = new HiveMetaStoreClient(clientHiveConf);
driver = DriverFactory.newDriver(clientHiveConf);
}
use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.
the class HCatDataCheckUtil method instantiateDriver.
public static IDriver instantiateDriver(MiniCluster cluster) {
HiveConf hiveConf = new HiveConf(HCatDataCheckUtil.class);
for (Entry e : cluster.getProperties().entrySet()) {
hiveConf.set(e.getKey().toString(), e.getValue().toString());
}
hiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
hiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
hiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
LOG.debug("Hive conf : {}", hiveConf.getAllProperties());
IDriver driver = DriverFactory.newDriver(hiveConf);
SessionState.start(new CliSessionState(hiveConf));
return driver;
}
use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.
the class QTestSyntaxUtil method checkSyntax.
private boolean checkSyntax(String cmd) {
ASTNode tree;
int ret = 0;
CliSessionState ss = (CliSessionState) SessionState.get();
String cmdTrimmed = HiveStringUtils.removeComments(cmd).trim();
String[] tokens = cmdTrimmed.split("\\s+");
if (tokens[0].equalsIgnoreCase("source")) {
return true;
}
if (cmdTrimmed.toLowerCase().equals("quit") || cmdTrimmed.toLowerCase().equals("exit")) {
return true;
}
if (cmdTrimmed.startsWith("!")) {
return true;
}
try {
CommandProcessor proc = CommandProcessorFactory.get(tokens, (HiveConf) conf);
if (proc instanceof IDriver) {
try {
tree = pd.parse(cmd, conf).getTree();
qTestUtil.analyzeAST(tree);
} catch (Exception e) {
return false;
}
} else {
ret = processLocalCmd(cmdTrimmed, proc, ss);
}
} catch (SQLException e) {
e.printStackTrace();
return false;
}
if (ret != 0) {
return false;
}
return true;
}
use of org.apache.hadoop.hive.cli.CliSessionState in project hive by apache.
the class TestE2EScenarios method setUp.
@Before
public void setUp() throws Exception {
File f = new File(TEST_WAREHOUSE_DIR);
if (f.exists()) {
FileUtil.fullyDelete(f);
}
if (!(new File(TEST_WAREHOUSE_DIR).mkdirs())) {
throw new RuntimeException("Could not create " + TEST_WAREHOUSE_DIR);
}
HiveConf hiveConf = new HiveConf(this.getClass());
hiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
hiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
hiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
hiveConf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, TEST_WAREHOUSE_DIR);
hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
driver = DriverFactory.newDriver(hiveConf);
SessionState.start(new CliSessionState(hiveConf));
}
Aggregations