Search in sources :

Example 56 with HiveSQLException

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

the class ThriftCLIServiceClient method fetchResults.

@Override
public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException {
    try {
        TFetchResultsReq req = new TFetchResultsReq();
        req.setOperationHandle(opHandle.toTOperationHandle());
        req.setOrientation(orientation.toTFetchOrientation());
        req.setMaxRows(maxRows);
        req.setFetchType(fetchType.toTFetchType());
        TFetchResultsResp resp = cliService.FetchResults(req);
        checkStatus(resp.getStatus());
        return RowSetFactory.create(resp.getResults(), opHandle.getProtocolVersion());
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : TFetchResultsResp(org.apache.hive.service.rpc.thrift.TFetchResultsResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TFetchResultsReq(org.apache.hive.service.rpc.thrift.TFetchResultsReq) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 57 with HiveSQLException

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

the class ThriftCLIServiceClient method openSession.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#openSession(java.lang.String, java.lang.String, java.util.Map)
   */
@Override
public SessionHandle openSession(String username, String password, Map<String, String> configuration) throws HiveSQLException {
    try {
        TOpenSessionReq req = new TOpenSessionReq();
        req.setUsername(username);
        req.setPassword(password);
        req.setConfiguration(configuration);
        TOpenSessionResp resp = cliService.OpenSession(req);
        checkStatus(resp.getStatus());
        return new SessionHandle(resp.getSessionHandle(), resp.getServerProtocolVersion());
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : HiveSQLException(org.apache.hive.service.cli.HiveSQLException) SessionHandle(org.apache.hive.service.cli.SessionHandle) TOpenSessionReq(org.apache.hive.service.rpc.thrift.TOpenSessionReq) TOpenSessionResp(org.apache.hive.service.rpc.thrift.TOpenSessionResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 58 with HiveSQLException

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

the class ThriftCLIServiceClient method getInfo.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#getInfo(org.apache.hive.service.cli.SessionHandle, java.util.List)
   */
@Override
public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType infoType) throws HiveSQLException {
    try {
        // FIXME extract the right info type
        TGetInfoReq req = new TGetInfoReq(sessionHandle.toTSessionHandle(), infoType.toTGetInfoType());
        TGetInfoResp resp = cliService.GetInfo(req);
        checkStatus(resp.getStatus());
        return new GetInfoValue(resp.getInfoValue());
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : TGetInfoReq(org.apache.hive.service.rpc.thrift.TGetInfoReq) GetInfoValue(org.apache.hive.service.cli.GetInfoValue) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TGetInfoResp(org.apache.hive.service.rpc.thrift.TGetInfoResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 59 with HiveSQLException

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

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

Aggregations

HiveSQLException (org.apache.hive.service.cli.HiveSQLException)83 OperationHandle (org.apache.hive.service.cli.OperationHandle)38 TException (org.apache.thrift.TException)25 SessionHandle (org.apache.hive.service.cli.SessionHandle)20 ExploreException (co.cask.cdap.explore.service.ExploreException)14 IOException (java.io.IOException)12 QueryHandle (co.cask.cdap.proto.QueryHandle)11 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)11 OperationManager (org.apache.hive.service.cli.operation.OperationManager)10 QueryStatus (co.cask.cdap.proto.QueryStatus)7 IMetaStoreClient (org.apache.hadoop.hive.metastore.IMetaStoreClient)7 SQLException (java.sql.SQLException)6 OperationStatus (org.apache.hive.service.cli.OperationStatus)5 TableSchema (org.apache.hive.service.cli.TableSchema)5 FileNotFoundException (java.io.FileNotFoundException)4 ArrayList (java.util.ArrayList)4 Metrics (org.apache.hadoop.hive.common.metrics.common.Metrics)3 HivePrivilegeObject (org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject)3 NamespaceNotFoundException (co.cask.cdap.common.NamespaceNotFoundException)2 HandleNotFoundException (co.cask.cdap.explore.service.HandleNotFoundException)2