Search in sources :

Example 86 with OperationHandle

use of org.apache.hive.service.cli.OperationHandle 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);
    }
}
Also used : TProtocolVersion(org.apache.hive.service.rpc.thrift.TProtocolVersion) TGetColumnsReq(org.apache.hive.service.rpc.thrift.TGetColumnsReq) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TOperationHandle(org.apache.hive.service.rpc.thrift.TOperationHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) TGetColumnsResp(org.apache.hive.service.rpc.thrift.TGetColumnsResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 87 with OperationHandle

use of org.apache.hive.service.cli.OperationHandle in project hive by apache.

the class ThriftCLIServiceClient method getTableTypes.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#getTableTypes(org.apache.hive.service.cli.SessionHandle)
   */
@Override
public OperationHandle getTableTypes(SessionHandle sessionHandle) throws HiveSQLException {
    try {
        TGetTableTypesReq req = new TGetTableTypesReq(sessionHandle.toTSessionHandle());
        TGetTableTypesResp resp = cliService.GetTableTypes(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);
    }
}
Also used : TProtocolVersion(org.apache.hive.service.rpc.thrift.TProtocolVersion) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TGetTableTypesResp(org.apache.hive.service.rpc.thrift.TGetTableTypesResp) TOperationHandle(org.apache.hive.service.rpc.thrift.TOperationHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) TGetTableTypesReq(org.apache.hive.service.rpc.thrift.TGetTableTypesReq) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 88 with OperationHandle

use of org.apache.hive.service.cli.OperationHandle 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)

Example 89 with OperationHandle

use of org.apache.hive.service.cli.OperationHandle in project hive by apache.

the class ThriftCLIServiceClient method getPrimaryKeys.

@Override
public OperationHandle getPrimaryKeys(SessionHandle sessionHandle, String catalog, String schema, String table) throws HiveSQLException {
    try {
        TGetPrimaryKeysReq req = new TGetPrimaryKeysReq(sessionHandle.toTSessionHandle());
        req.setCatalogName(catalog);
        req.setSchemaName(schema);
        req.setTableName(table);
        TGetPrimaryKeysResp resp = cliService.GetPrimaryKeys(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);
    }
}
Also used : TGetPrimaryKeysReq(org.apache.hive.service.rpc.thrift.TGetPrimaryKeysReq) TProtocolVersion(org.apache.hive.service.rpc.thrift.TProtocolVersion) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TGetPrimaryKeysResp(org.apache.hive.service.rpc.thrift.TGetPrimaryKeysResp) TOperationHandle(org.apache.hive.service.rpc.thrift.TOperationHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 90 with OperationHandle

use of org.apache.hive.service.cli.OperationHandle in project hive by apache.

the class ThriftCLIServiceClient method getTables.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#getTables(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String, java.lang.String, java.util.List)
   */
@Override
public OperationHandle getTables(SessionHandle sessionHandle, String catalogName, String schemaName, String tableName, List<String> tableTypes) throws HiveSQLException {
    try {
        TGetTablesReq req = new TGetTablesReq(sessionHandle.toTSessionHandle());
        req.setTableName(tableName);
        req.setTableTypes(tableTypes);
        req.setSchemaName(schemaName);
        TGetTablesResp resp = cliService.GetTables(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);
    }
}
Also used : TGetTablesResp(org.apache.hive.service.rpc.thrift.TGetTablesResp) TProtocolVersion(org.apache.hive.service.rpc.thrift.TProtocolVersion) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TGetTablesReq(org.apache.hive.service.rpc.thrift.TGetTablesReq) TOperationHandle(org.apache.hive.service.rpc.thrift.TOperationHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Aggregations

OperationHandle (org.apache.hive.service.cli.OperationHandle)104 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)63 SessionHandle (org.apache.hive.service.cli.SessionHandle)47 Test (org.junit.Test)35 TException (org.apache.thrift.TException)31 RowSet (org.apache.hive.service.cli.RowSet)21 IOException (java.io.IOException)20 UnknownHostException (java.net.UnknownHostException)17 LoginException (javax.security.auth.login.LoginException)17 ServiceException (org.apache.hive.service.ServiceException)17 OperationManager (org.apache.hive.service.cli.operation.OperationManager)14 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)13 ExploreException (co.cask.cdap.explore.service.ExploreException)12 TOperationHandle (org.apache.hive.service.rpc.thrift.TOperationHandle)12 QueryHandle (co.cask.cdap.proto.QueryHandle)11 OperationStatus (org.apache.hive.service.cli.OperationStatus)8 HashMap (java.util.HashMap)7 CLIServiceClient (org.apache.hive.service.cli.CLIServiceClient)6 ArrayList (java.util.ArrayList)5 OperationState (org.apache.hive.service.cli.OperationState)5