use of org.apache.thrift.TException in project hive by apache.
the class ThriftCLIService method GetSchemas.
@Override
public TGetSchemasResp GetSchemas(TGetSchemasReq req) throws TException {
TGetSchemasResp resp = new TGetSchemasResp();
try {
OperationHandle opHandle = cliService.getSchemas(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting schemas: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
return resp;
}
use of org.apache.thrift.TException in project hive by apache.
the class ThriftCLIService method FetchResults.
@Override
public TFetchResultsResp FetchResults(TFetchResultsReq req) throws TException {
TFetchResultsResp resp = new TFetchResultsResp();
try {
// Set fetch size
int maxFetchSize = hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_MAX_FETCH_SIZE);
if (req.getMaxRows() > maxFetchSize) {
req.setMaxRows(maxFetchSize);
}
RowSet rowSet = cliService.fetchResults(new OperationHandle(req.getOperationHandle()), FetchOrientation.getFetchOrientation(req.getOrientation()), req.getMaxRows(), FetchType.getFetchType(req.getFetchType()));
resp.setResults(rowSet.toTRowSet());
resp.setHasMoreRows(false);
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error fetching results: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
return resp;
}
use of org.apache.thrift.TException in project hive by apache.
the class ThriftCLIService method GetColumns.
@Override
public TGetColumnsResp GetColumns(TGetColumnsReq req) throws TException {
TGetColumnsResp resp = new TGetColumnsResp();
try {
OperationHandle opHandle = cliService.getColumns(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName(), req.getTableName(), req.getColumnName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting columns: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
return resp;
}
use of org.apache.thrift.TException 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.thrift.TException in project buck by facebook.
the class ThriftCoordinatorClient method finishedBuilding.
public FinishedBuildingResponse finishedBuilding(String minionId, int minionExitCode) throws IOException {
LOG.debug(String.format("Minion [%s] is reporting that it finished building.", minionId));
Preconditions.checkNotNull(client, "Client was not started.");
FinishedBuildingRequest request = new FinishedBuildingRequest().setStampedeId(stampedeId).setMinionId(minionId).setBuildExitCode(minionExitCode);
try {
FinishedBuildingResponse response = client.finishedBuilding(request);
return response;
} catch (TException e) {
throw new ThriftException(e);
}
}
Aggregations