Search in sources :

Example 1 with TGetFunctionsResp

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

the class ThriftCLIServiceClient method getFunctions.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#getFunctions(org.apache.hive.service.cli.SessionHandle)
   */
@Override
public OperationHandle getFunctions(SessionHandle sessionHandle, String catalogName, String schemaName, String functionName) throws HiveSQLException {
    try {
        TGetFunctionsReq req = new TGetFunctionsReq(sessionHandle.toTSessionHandle(), functionName);
        req.setCatalogName(catalogName);
        req.setSchemaName(schemaName);
        TGetFunctionsResp resp = cliService.GetFunctions(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) TGetFunctionsResp(org.apache.hive.service.rpc.thrift.TGetFunctionsResp) TGetFunctionsReq(org.apache.hive.service.rpc.thrift.TGetFunctionsReq) OperationHandle(org.apache.hive.service.cli.OperationHandle) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 2 with TGetFunctionsResp

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

the class ThriftCLIService method GetFunctions.

@Override
public TGetFunctionsResp GetFunctions(TGetFunctionsReq req) throws TException {
    TGetFunctionsResp resp = new TGetFunctionsResp();
    try {
        OperationHandle opHandle = cliService.getFunctions(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName(), req.getFunctionName());
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error getting functions: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TGetFunctionsResp(org.apache.hive.service.rpc.thrift.TGetFunctionsResp) SessionHandle(org.apache.hive.service.cli.SessionHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) LoginException(javax.security.auth.login.LoginException) ServiceException(org.apache.hive.service.ServiceException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Example 3 with TGetFunctionsResp

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

the class HiveDatabaseMetaData method getFunctions.

public ResultSet getFunctions(String catalogName, String schemaPattern, String functionNamePattern) throws SQLException {
    TGetFunctionsResp funcResp;
    TGetFunctionsReq getFunctionsReq = new TGetFunctionsReq();
    getFunctionsReq.setSessionHandle(sessHandle);
    getFunctionsReq.setCatalogName(catalogName);
    getFunctionsReq.setSchemaName(schemaPattern);
    getFunctionsReq.setFunctionName(functionNamePattern);
    try {
        funcResp = client.GetFunctions(getFunctionsReq);
    } catch (TException e) {
        throw new SQLException(e.getMessage(), "08S01", e);
    }
    Utils.verifySuccess(funcResp.getStatus());
    return new HiveQueryResultSet.Builder(connection).setClient(client).setSessionHandle(sessHandle).setStmtHandle(funcResp.getOperationHandle()).build();
}
Also used : TException(org.apache.thrift.TException) SQLException(java.sql.SQLException) TGetFunctionsResp(org.apache.hive.service.rpc.thrift.TGetFunctionsResp) TGetFunctionsReq(org.apache.hive.service.rpc.thrift.TGetFunctionsReq)

Aggregations

TGetFunctionsResp (org.apache.hive.service.rpc.thrift.TGetFunctionsResp)3 TException (org.apache.thrift.TException)3 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)2 OperationHandle (org.apache.hive.service.cli.OperationHandle)2 TGetFunctionsReq (org.apache.hive.service.rpc.thrift.TGetFunctionsReq)2 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 SQLException (java.sql.SQLException)1 LoginException (javax.security.auth.login.LoginException)1 ServiceException (org.apache.hive.service.ServiceException)1 SessionHandle (org.apache.hive.service.cli.SessionHandle)1 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)1