use of org.apache.hive.service.rpc.thrift.TGetColumnsReq 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.TGetColumnsReq 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).setSessionHandle(sessHandle).setStmtHandle(colResp.getOperationHandle()).build();
}
Aggregations