Search in sources :

Example 1 with TDownloadDataReq

use of org.apache.hive.service.rpc.thrift.TDownloadDataReq in project hive by apache.

the class ThriftCLIServiceClient method downloadData.

@Override
public OperationHandle downloadData(SessionHandle sessionHandle, String tableName, String query, String format, Map<String, String> options) throws HiveSQLException {
    try {
        TDownloadDataReq req = new TDownloadDataReq(sessionHandle.toTSessionHandle());
        req.setTableName(tableName);
        req.setQuery(query);
        req.setFormat(format);
        req.setDownloadOptions(options);
        TDownloadDataResp resp = cliService.DownloadData(req);
        checkStatus(resp.getStatus());
        TProtocolVersion protocol = sessionHandle.getProtocolVersion();
        return new OperationHandle(resp.getOperationHandle(), protocol);
    } catch (TException e) {
        throw new HiveSQLException(e);
    }
}
Also used : TException(org.apache.thrift.TException) TProtocolVersion(org.apache.hive.service.rpc.thrift.TProtocolVersion) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TDownloadDataReq(org.apache.hive.service.rpc.thrift.TDownloadDataReq) TDownloadDataResp(org.apache.hive.service.rpc.thrift.TDownloadDataResp) TOperationHandle(org.apache.hive.service.rpc.thrift.TOperationHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle)

Aggregations

HiveSQLException (org.apache.hive.service.cli.HiveSQLException)1 OperationHandle (org.apache.hive.service.cli.OperationHandle)1 TDownloadDataReq (org.apache.hive.service.rpc.thrift.TDownloadDataReq)1 TDownloadDataResp (org.apache.hive.service.rpc.thrift.TDownloadDataResp)1 TOperationHandle (org.apache.hive.service.rpc.thrift.TOperationHandle)1 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)1 TException (org.apache.thrift.TException)1