use of org.apache.hive.service.rpc.thrift.TGetCrossReferenceResp in project hive by apache.
the class HiveDatabaseMetaData method getCrossReference.
public ResultSet getCrossReference(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException {
TGetCrossReferenceResp getFKResp;
TGetCrossReferenceReq getFKReq = new TGetCrossReferenceReq(sessHandle);
getFKReq.setParentTableName(primaryTable);
getFKReq.setParentSchemaName(primarySchema);
getFKReq.setParentCatalogName(primaryCatalog);
getFKReq.setForeignTableName(foreignTable);
getFKReq.setForeignSchemaName(foreignSchema);
getFKReq.setForeignCatalogName(foreignCatalog);
try {
getFKResp = client.GetCrossReference(getFKReq);
} catch (TException e) {
throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(getFKResp.getStatus());
return new HiveQueryResultSet.Builder(connection).setClient(client).setSessionHandle(sessHandle).setStmtHandle(getFKResp.getOperationHandle()).build();
}
use of org.apache.hive.service.rpc.thrift.TGetCrossReferenceResp in project hive by apache.
the class ThriftCLIService method GetCrossReference.
@Override
public TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req) throws TException {
TGetCrossReferenceResp resp = new TGetCrossReferenceResp();
try {
OperationHandle opHandle = cliService.getCrossReference(new SessionHandle(req.getSessionHandle()), req.getParentCatalogName(), req.getParentSchemaName(), req.getParentTableName(), req.getForeignCatalogName(), req.getForeignSchemaName(), req.getForeignTableName());
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.TGetCrossReferenceResp in project hive by apache.
the class ThriftCLIServiceClient method getCrossReference.
@Override
public OperationHandle getCrossReference(SessionHandle sessionHandle, String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws HiveSQLException {
try {
TGetCrossReferenceReq req = new TGetCrossReferenceReq(sessionHandle.toTSessionHandle());
req.setParentCatalogName(primaryCatalog);
req.setParentSchemaName(primarySchema);
req.setParentTableName(primaryTable);
req.setForeignCatalogName(foreignCatalog);
req.setForeignSchemaName(foreignSchema);
req.setForeignTableName(foreignTable);
TGetCrossReferenceResp resp = cliService.GetCrossReference(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);
}
}
Aggregations