use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class ThriftCLIServiceClient method getCatalogs.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getCatalogs(org.apache.hive.service.cli.SessionHandle)
*/
@Override
public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLException {
try {
TGetCatalogsReq req = new TGetCatalogsReq(sessionHandle.toTSessionHandle());
TGetCatalogsResp resp = cliService.GetCatalogs(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class ThriftCLIServiceClient method cancelOperation.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#cancelOperation(org.apache.hive.service.cli.OperationHandle)
*/
@Override
public void cancelOperation(OperationHandle opHandle) throws HiveSQLException {
try {
TCancelOperationReq req = new TCancelOperationReq(opHandle.toTOperationHandle());
TCancelOperationResp resp = cliService.CancelOperation(req);
checkStatus(resp.getStatus());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class ThriftCLIServiceClient method getFunctions.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getFunctions(org.apache.hive.service.cli.SessionHandle)
*/
@Override
public OperationHandle getFunctions(SessionHandle sessionHandle, String catalogName, String schemaName, String functionName) throws HiveSQLException {
try {
TGetFunctionsReq req = new TGetFunctionsReq(sessionHandle.toTSessionHandle(), functionName);
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
TGetFunctionsResp resp = cliService.GetFunctions(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class KillQueryImpl method killQuery.
@Override
public void killQuery(String queryId, String errMsg) throws HiveException {
try {
Operation operation = operationManager.getOperationByQueryId(queryId);
if (operation == null) {
LOG.info("Query not found: " + queryId);
} else {
OperationHandle handle = operation.getHandle();
operationManager.cancelOperation(handle, errMsg);
}
} catch (HiveSQLException e) {
throw new HiveException(e);
}
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class TestHiveServer2SessionTimeout method testConnection.
@Test
public void testConnection() throws Exception {
CLIServiceClient serviceClient = miniHS2.getServiceClient();
SessionHandle sessHandle = serviceClient.openSession("foo", "bar");
OperationHandle handle = serviceClient.executeStatement(sessHandle, "SELECT 1", confOverlay);
Thread.sleep(7000);
try {
serviceClient.closeOperation(handle);
fail("Operation should have been closed by timeout!");
} catch (HiveSQLException e) {
assertTrue(StringUtils.stringifyException(e), e.getMessage().contains("Invalid OperationHandle"));
}
}
Aggregations