use of org.apache.hive.service.cli.CLIService in project hive by apache.
the class TestPluggableHiveSessionImpl method testSessionImpl.
@Test
public void testSessionImpl() throws Exception {
HiveConf hiveConf = new HiveConf();
hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.getDefaultValue());
hiveConf.setVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_CLASSNAME, SampleHiveSessionImpl.class.getName());
hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS, false);
CLIService cliService = new CLIService(null);
cliService.init(hiveConf);
ThriftBinaryCLIService service = new ThriftBinaryCLIService(cliService, null);
service.init(hiveConf);
ThriftCLIServiceClient client = new ThriftCLIServiceClient(service);
SessionHandle sessionHandle = null;
sessionHandle = client.openSession("tom", "password");
assertEquals(SampleHiveSessionImpl.class.getName(), service.getHiveConf().getVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_CLASSNAME));
HiveSession session = cliService.getSessionManager().getSession(sessionHandle);
assertEquals(SampleHiveSessionImpl.MAGIC_RETURN_VALUE, session.getNoOperationTime());
client.closeSession(sessionHandle);
}
use of org.apache.hive.service.cli.CLIService in project cdap by caskdata.
the class Hive14ExploreService method initOperationStatus.
private Method initOperationStatus() {
/*
Hive 1.2.1000.2.6.0.0-598, that ships with HDP 2.6.0 introduced a change as part of
https://issues.apache.org/jira/browse/HIVE-15473 in the getOperationStatus method and introduced a boolean argument
to get the progress update for the operation. Previous versions of the method just took an {@link OperationHandle}
as the single argument.
To handle this we are using reflection to find out how many arguments the method takes and then call it accordingly.
*/
CLIService cliService = getCliService();
Method getOperationStatus = null;
for (Method method : cliService.getClass().getMethods()) {
if ("getOperationStatus".equals(method.getName())) {
getOperationStatus = method;
break;
}
}
if (getOperationStatus == null) {
throw new RuntimeException("Unable to find getOperationStatus method from the Hive CLIService.");
}
return getOperationStatus;
}
Aggregations