use of org.apache.hive.service.rpc.thrift.TCloseOperationResp in project hive by apache.
the class HiveQueryResultSet method closeOperationHandle.
private void closeOperationHandle(TOperationHandle stmtHandle) throws SQLException {
try {
if (stmtHandle != null) {
TCloseOperationReq closeReq = new TCloseOperationReq(stmtHandle);
TCloseOperationResp closeResp = client.CloseOperation(closeReq);
Utils.verifySuccessWithInfo(closeResp.getStatus());
}
} catch (SQLException e) {
throw e;
} catch (Exception e) {
throw new SQLException(e.toString(), "08S01", e);
}
}
use of org.apache.hive.service.rpc.thrift.TCloseOperationResp in project hive by apache.
the class HiveStatement method closeStatementIfNeeded.
/**
* Closes the statement if there is one running. Do not change the the flags.
* @throws SQLException If there is an error closing the statement
*/
private void closeStatementIfNeeded() throws SQLException {
try {
if (stmtHandle.isPresent()) {
TCloseOperationReq closeReq = new TCloseOperationReq(stmtHandle.get());
TCloseOperationResp closeResp = client.CloseOperation(closeReq);
if (!checkInvalidOperationHandle(closeResp)) {
Utils.verifySuccessWithInfo(closeResp.getStatus());
}
}
} catch (SQLException e) {
throw e;
} catch (TApplicationException tae) {
String errorMsg = "Failed to close statement";
if (tae.getType() == TApplicationException.BAD_SEQUENCE_ID) {
errorMsg = "Failed to close statement. Mismatch thrift sequence id. A previous call to the Thrift library" + " failed and now position within the input stream is lost. Please enable verbose error logging and" + " check the status of previous calls.";
}
throw new SQLException(errorMsg, "08S01", tae);
} catch (Exception e) {
throw new SQLException("Failed to close statement", "08S01", e);
} finally {
stmtHandle = Optional.empty();
}
}
use of org.apache.hive.service.rpc.thrift.TCloseOperationResp in project hive by apache.
the class HiveStatement method closeClientOperation.
void closeClientOperation() throws SQLException {
try {
if (stmtHandle != null) {
TCloseOperationReq closeReq = new TCloseOperationReq(stmtHandle);
TCloseOperationResp closeResp = client.CloseOperation(closeReq);
Utils.verifySuccessWithInfo(closeResp.getStatus());
}
} catch (SQLException e) {
throw e;
} catch (Exception e) {
throw new SQLException(e.toString(), "08S01", e);
}
isQueryClosed = true;
isExecuteStatementFailed = false;
stmtHandle = null;
}
use of org.apache.hive.service.rpc.thrift.TCloseOperationResp in project hive by apache.
the class ThriftCLIService method CloseOperation.
@Override
public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException {
TCloseOperationResp resp = new TCloseOperationResp();
try {
cliService.closeOperation(new OperationHandle(req.getOperationHandle()));
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.error("Failed to close operation [request: {}]", req, e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
return resp;
}
use of org.apache.hive.service.rpc.thrift.TCloseOperationResp in project hive by apache.
the class ThriftCLIServiceClient method closeOperation.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#closeOperation(org.apache.hive.service.cli.OperationHandle)
*/
@Override
public void closeOperation(OperationHandle opHandle) throws HiveSQLException {
try {
TCloseOperationReq req = new TCloseOperationReq(opHandle.toTOperationHandle());
TCloseOperationResp resp = cliService.CloseOperation(req);
checkStatus(resp.getStatus());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
}
Aggregations