use of org.apache.hive.service.rpc.thrift.TGetColumnsResp 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.error("Failed to get column types [request: {}]", req, e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
return resp;
}
use of org.apache.hive.service.rpc.thrift.TGetColumnsResp in project hive by apache.
the class ThriftCLIServiceClient method getColumns.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getColumns(org.apache.hive.service.cli.SessionHandle)
*/
@Override
public OperationHandle getColumns(SessionHandle sessionHandle, String catalogName, String schemaName, String tableName, String columnName) throws HiveSQLException {
try {
TGetColumnsReq req = new TGetColumnsReq();
req.setSessionHandle(sessionHandle.toTSessionHandle());
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
req.setTableName(tableName);
req.setColumnName(columnName);
TGetColumnsResp resp = cliService.GetColumns(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.TGetColumnsResp in project hive by apache.
the class HiveDatabaseMetaData method getColumns.
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
TGetColumnsResp colResp;
TGetColumnsReq colReq = new TGetColumnsReq();
colReq.setSessionHandle(sessHandle);
colReq.setCatalogName(catalog);
colReq.setSchemaName(schemaPattern);
colReq.setTableName(tableNamePattern);
colReq.setColumnName(columnNamePattern);
try {
colResp = client.GetColumns(colReq);
} catch (TException e) {
throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(colResp.getStatus());
// build the resultset from response
return new HiveQueryResultSet.Builder(connection).setClient(client).setStmtHandle(colResp.getOperationHandle()).build();
}
Aggregations