public void cancelDelegationToken(String tokenStr) throws SQLException { TCancelDelegationTokenReq cancelReq = new TCancelDelegationTokenReq(sessHandle, tokenStr); try { TCancelDelegationTokenResp cancelResp = client.CancelDelegationToken(cancelReq); Utils.verifySuccess(cancelResp.getStatus()); return; } catch (TException e) { throw new SQLException("Could not cancel token: " + e.getMessage(), " 08S01", e); } }
@Override public void cancel() throws SQLException { checkConnection("cancel"); if (isCancelled) { return; } transportLock.lock(); try { if (stmtHandle != null) { TCancelOperationReq cancelReq = new TCancelOperationReq(stmtHandle); TCancelOperationResp cancelResp = client.CancelOperation(cancelReq); Utils.verifySuccessWithInfo(cancelResp.getStatus()); } } catch (SQLException e) { throw e; } catch (Exception e) { throw new SQLException(e.toString(), "08S01", e); } finally { transportLock.unlock(); } isCancelled = true; }
void closeClientOperation() throws SQLException { transportLock.lock(); try { if (stmtHandle != null) { TCloseOperationReq closeReq = new TCloseOperationReq(stmtHandle); TCloseOperationResp closeResp = client.CloseOperation(closeReq); Utils.verifySuccessWithInfo(closeResp.getStatus()); } } catch (SQLException e) { throw e; } catch (Exception e) { throw new SQLException(e.toString(), "08S01", e); } finally { transportLock.unlock(); } isQueryClosed = true; isExecuteStatementFailed = false; stmtHandle = null; }
TExecuteStatementResp execResp = client.ExecuteStatement(execReq); Utils.verifySuccessWithInfo(execResp.getStatus()); stmtHandle = execResp.getOperationHandle(); statusResp = client.GetOperationStatus(statusReq); } finally { transportLock.unlock();
TExecuteStatementResp execResp = client.ExecuteStatement(execReq); Utils.verifySuccessWithInfo(execResp.getStatus()); stmtHandle = execResp.getOperationHandle(); statusResp = client.GetOperationStatus(statusReq); } finally { transportLock.unlock();
getFetchOrientation(incremental), fetchSize); tFetchResultsReq.setFetchType((short)1); tFetchResultsResp = client.FetchResults(tFetchResultsReq); Utils.verifySuccessWithInfo(tFetchResultsResp.getStatus()); } else {
getFetchOrientation(incremental), fetchSize); tFetchResultsReq.setFetchType((short)1); tFetchResultsResp = client.FetchResults(tFetchResultsReq); Utils.verifySuccessWithInfo(tFetchResultsResp.getStatus()); } else {
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(); }
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(); }
@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); } }
@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); } }
@Override public void cancel() throws SQLException { checkConnection("cancel"); if (isCancelled) { return; } transportLock.lock(); try { if (stmtHandle != null) { TCancelOperationReq cancelReq = new TCancelOperationReq(stmtHandle); TCancelOperationResp cancelResp = client.CancelOperation(cancelReq); Utils.verifySuccessWithInfo(cancelResp.getStatus()); } } catch (SQLException e) { throw e; } catch (Exception e) { throw new SQLException(e.toString(), "08S01", e); } finally { transportLock.unlock(); } isCancelled = true; }
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(); }
@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); } }
@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); } }
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(); }
void closeClientOperation() throws SQLException { transportLock.lock(); try { if (stmtHandle != null) { TCloseOperationReq closeReq = new TCloseOperationReq(stmtHandle); TCloseOperationResp closeResp = client.CloseOperation(closeReq); Utils.verifySuccessWithInfo(closeResp.getStatus()); } } catch (SQLException e) { throw e; } catch (Exception e) { throw new SQLException(e.toString(), "08S01", e); } finally { transportLock.unlock(); } isQueryClosed = true; isExecuteStatementFailed = false; stmtHandle = null; }
private OperationHandle executeStatementInternal(SessionHandle sessionHandle, String statement, Map<String, String> confOverlay, boolean isAsync) throws HiveSQLException { try { TExecuteStatementReq req = new TExecuteStatementReq(sessionHandle.toTSessionHandle(), statement); req.setConfOverlay(confOverlay); req.setRunAsync(isAsync); TExecuteStatementResp resp = cliService.ExecuteStatement(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); } }
@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); } }
private OperationHandle executeStatementInternal(SessionHandle sessionHandle, String statement, Map<String, String> confOverlay, boolean isAsync) throws HiveSQLException { try { TExecuteStatementReq req = new TExecuteStatementReq(sessionHandle.toTSessionHandle(), statement); req.setConfOverlay(confOverlay); req.setRunAsync(isAsync); TExecuteStatementResp resp = cliService.ExecuteStatement(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); } }