use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class ThriftCLIServiceClient method executeStatementInternal.
private OperationHandle executeStatementInternal(SessionHandle sessionHandle, String statement, Map<String, String> confOverlay, boolean isAsync, long queryTimeout) throws HiveSQLException {
try {
TExecuteStatementReq req = new TExecuteStatementReq(sessionHandle.toTSessionHandle(), statement);
req.setConfOverlay(confOverlay);
req.setRunAsync(isAsync);
req.setQueryTimeout(queryTimeout);
TExecuteStatementResp resp = cliService.ExecuteStatement(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 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 ThriftCLIServiceClient method cancelDelegationToken.
@Override
public void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
TCancelDelegationTokenReq cancelReq = new TCancelDelegationTokenReq(sessionHandle.toTSessionHandle(), tokenStr);
try {
TCancelDelegationTokenResp cancelResp = cliService.CancelDelegationToken(cancelReq);
checkStatus(cancelResp.getStatus());
return;
} catch (TException e) {
throw new HiveSQLException(e);
}
}
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 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 {
try {
TGetOperationStatusReq req = new TGetOperationStatusReq(opHandle.toTOperationHandle());
req.setGetProgressUpdate(getProgressUpdate);
TGetOperationStatusResp resp = cliService.GetOperationStatus(req);
// Checks the status of the RPC call, throws an exception in case of error
checkStatus(resp.getStatus());
OperationState opState = OperationState.getOperationState(resp.getOperationState());
HiveSQLException opException = null;
if (opState == OperationState.ERROR) {
opException = new HiveSQLException(resp.getErrorMessage(), resp.getSqlState(), resp.getErrorCode());
}
return new OperationStatus(opState, resp.getTaskStatus(), resp.getOperationStarted(), resp.getOperationCompleted(), resp.isHasResultSet(), opException);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
}
Aggregations