use of org.apache.hive.service.rpc.thrift.TGetPrimaryKeysResp in project hive by apache.
the class ThriftCLIService method GetPrimaryKeys.
@Override
public TGetPrimaryKeysResp GetPrimaryKeys(TGetPrimaryKeysReq req) throws TException {
TGetPrimaryKeysResp resp = new TGetPrimaryKeysResp();
try {
OperationHandle opHandle = cliService.getPrimaryKeys(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName(), req.getTableName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting functions: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
return resp;
}
use of org.apache.hive.service.rpc.thrift.TGetPrimaryKeysResp in project hive by apache.
the class ThriftCLIServiceClient method getPrimaryKeys.
@Override
public OperationHandle getPrimaryKeys(SessionHandle sessionHandle, String catalog, String schema, String table) throws HiveSQLException {
try {
TGetPrimaryKeysReq req = new TGetPrimaryKeysReq(sessionHandle.toTSessionHandle());
req.setCatalogName(catalog);
req.setSchemaName(schema);
req.setTableName(table);
TGetPrimaryKeysResp resp = cliService.GetPrimaryKeys(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.rpc.thrift.TGetPrimaryKeysResp in project hive by apache.
the class HiveDatabaseMetaData method getPrimaryKeys.
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
TGetPrimaryKeysResp getPKResp;
TGetPrimaryKeysReq getPKReq = new TGetPrimaryKeysReq(sessHandle);
getPKReq.setTableName(table);
getPKReq.setSchemaName(schema);
getPKReq.setCatalogName(catalog);
try {
getPKResp = client.GetPrimaryKeys(getPKReq);
} catch (TException e) {
throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(getPKResp.getStatus());
return new HiveQueryResultSet.Builder(connection).setClient(client).setSessionHandle(sessHandle).setStmtHandle(getPKResp.getOperationHandle()).build();
}
Aggregations