use of org.apache.hive.service.rpc.thrift.TGetSchemasResp 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.hive.service.rpc.thrift.TGetSchemasResp in project hive by apache.
the class ThriftCLIServiceClient method getSchemas.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getSchemas(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String)
*/
@Override
public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName, String schemaName) throws HiveSQLException {
try {
TGetSchemasReq req = new TGetSchemasReq(sessionHandle.toTSessionHandle());
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
TGetSchemasResp resp = cliService.GetSchemas(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.TGetSchemasResp in project hive by apache.
the class HiveDatabaseMetaData method getSchemas.
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
TGetSchemasResp schemaResp;
TGetSchemasReq schemaReq = new TGetSchemasReq();
schemaReq.setSessionHandle(sessHandle);
if (catalog != null) {
schemaReq.setCatalogName(catalog);
}
if (schemaPattern == null) {
schemaPattern = "%";
}
schemaReq.setSchemaName(schemaPattern);
try {
schemaResp = client.GetSchemas(schemaReq);
} catch (TException e) {
throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(schemaResp.getStatus());
return new HiveQueryResultSet.Builder(connection).setClient(client).setSessionHandle(sessHandle).setStmtHandle(schemaResp.getOperationHandle()).build();
}
Aggregations