use of org.apache.thrift.TException in project hive by apache.
the class ThriftCLIService method GetCatalogs.
@Override
public TGetCatalogsResp GetCatalogs(TGetCatalogsReq req) throws TException {
TGetCatalogsResp resp = new TGetCatalogsResp();
try {
OperationHandle opHandle = cliService.getCatalogs(new SessionHandle(req.getSessionHandle()));
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting catalogs: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
return resp;
}
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);
}
}
Aggregations