use of org.apache.hive.service.rpc.thrift.TGetCrossReferenceReq 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).setStmtHandle(getFKResp.getOperationHandle()).build();
}
use of org.apache.hive.service.rpc.thrift.TGetCrossReferenceReq 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