use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestAddResource method setup.
@Before
public void setup() throws IOException {
conf = new HiveConf();
t = ResourceType.JAR;
//Generate test jar files
for (int i = 1; i <= 5; i++) {
Writer output = null;
String dataFile = TEST_JAR_DIR + "testjar" + i + ".jar";
File file = new File(dataFile);
output = new BufferedWriter(new FileWriter(file));
output.write("sample");
output.close();
}
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestSessionState method testClassLoaderEquality.
@Test
public void testClassLoaderEquality() throws Exception {
HiveConf conf = new HiveConf();
final SessionState ss1 = new SessionState(conf);
RegisterJarRunnable otherThread = new RegisterJarRunnable("./build/contrib/test/test-udfs.jar", ss1);
Thread th1 = new Thread(otherThread);
th1.start();
th1.join();
// set state in current thread
SessionState.start(ss1);
SessionState ss2 = SessionState.get();
ClassLoader loader2 = ss2.getConf().getClassLoader();
System.out.println("Loader1:(Set in other thread) " + otherThread.loader);
System.out.println("Loader2:(Set in SessionState.conf) " + loader2);
System.out.println("Loader3:(CurrentThread.getContextClassLoader()) " + Thread.currentThread().getContextClassLoader());
assertEquals("Other thread loader and session state loader", otherThread.loader, loader2);
assertEquals("Other thread loader and current thread loader", otherThread.loader, Thread.currentThread().getContextClassLoader());
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class CLIService method getOperationStatus.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getOperationStatus(org.apache.hive.service.cli.OperationHandle)
*/
@Override
public OperationStatus getOperationStatus(OperationHandle opHandle, boolean getProgressUpdate) throws HiveSQLException {
Operation operation = sessionManager.getOperationManager().getOperation(opHandle);
/**
* If this is a background operation run asynchronously,
* we block for a duration determined by a step function, before we return
* However, if the background operation is complete, we return immediately.
*/
HiveConf conf = operation.getParentSession().getHiveConf();
if (operation.shouldRunAsync()) {
long maxTimeout = HiveConf.getTimeVar(conf, HiveConf.ConfVars.HIVE_SERVER2_LONG_POLLING_TIMEOUT, TimeUnit.MILLISECONDS);
final long elapsed = System.currentTimeMillis() - operation.getBeginTime();
// A step function to increase the polling timeout by 500 ms every 10 sec,
// starting from 500 ms up to HIVE_SERVER2_LONG_POLLING_TIMEOUT
final long timeout = Math.min(maxTimeout, (elapsed / TimeUnit.SECONDS.toMillis(10) + 1) * 500);
try {
operation.getBackgroundHandle().get(timeout, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
// No Op, return to the caller since long polling timeout has expired
LOG.trace(opHandle + ": Long polling timed out");
} catch (CancellationException e) {
// The background operation thread was cancelled
LOG.trace(opHandle + ": The background operation was cancelled", e);
} catch (ExecutionException e) {
// Note: Hive ops do not use the normal Future failure path, so this will not happen
// in case of actual failure; the Future will just be done.
// The background operation thread was aborted
LOG.warn(opHandle + ": The background operation was aborted", e);
} catch (InterruptedException e) {
// No op, this thread was interrupted
// In this case, the call might return sooner than long polling timeout
}
}
OperationStatus opStatus = operation.getStatus();
LOG.debug(opHandle + ": getOperationStatus()");
opStatus.setJobProgressUpdate(progressUpdateLog(getProgressUpdate, operation, conf));
return opStatus;
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestHS2HttpServer method beforeTests.
@BeforeClass
public static void beforeTests() throws Exception {
webUIPort = MetaStoreUtils.findFreePortExcepting(Integer.valueOf(ConfVars.HIVE_SERVER2_WEBUI_PORT.getDefaultValue()));
hiveConf = new HiveConf();
hiveConf.set(ConfVars.METASTOREPWD.varname, metastorePasswd);
hiveConf.set(ConfVars.HIVE_SERVER2_WEBUI_PORT.varname, webUIPort.toString());
hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
hiveServer2 = new HiveServer2();
hiveServer2.init(hiveConf);
hiveServer2.start();
Thread.sleep(5000);
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestRetryingThriftCLIServiceClient method init.
@Before
public void init() {
hiveConf = new HiveConf();
hiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST, "localhost");
hiveConf.setIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT, 15000);
hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS, false);
hiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_AUTHENTICATION, HiveAuthFactory.AuthTypes.NONE.toString());
hiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_TRANSPORT_MODE, "binary");
hiveConf.setIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_CLIENT_RETRY_LIMIT, 3);
hiveConf.setIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_CLIENT_CONNECTION_RETRY_LIMIT, 3);
hiveConf.setIntVar(HiveConf.ConfVars.HIVE_SERVER2_ASYNC_EXEC_THREADS, 10);
hiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_ASYNC_EXEC_SHUTDOWN_TIMEOUT, "1s");
hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
}
Aggregations