public Object getFieldValue(_Fields field) { switch (field) { case STATUS: return getStatus(); case OPERATION_HANDLE: return getOperationHandle(); } throw new IllegalStateException(); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, ExecuteStatement_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.success = new TExecuteStatementResp(); struct.success.read(iprot); struct.setSuccessIsSet(true); } } }
public void setFieldValue(_Fields field, Object value) { switch (field) { case STATUS: if (value == null) { unsetStatus(); } else { setStatus((TStatus)value); } break; case OPERATION_HANDLE: if (value == null) { unsetOperationHandle(); } else { setOperationHandle((TOperationHandle)value); } break; } }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case STATUS: return isSetStatus(); case OPERATION_HANDLE: return isSetOperationHandle(); } throw new IllegalStateException(); }
@Override public TExecuteStatementResp ExecuteStatement(TExecuteStatementReq req) throws TException { TExecuteStatementResp resp = new TExecuteStatementResp(); try { SessionHandle sessionHandle = new SessionHandle(req.getSessionHandle()); String statement = req.getStatement(); Map<String, String> confOverlay = req.getConfOverlay(); Boolean runAsync = req.isRunAsync(); long queryTimeout = req.getQueryTimeout(); OperationHandle operationHandle = runAsync ? cliService.executeStatementAsync(sessionHandle, statement, confOverlay, queryTimeout) : cliService.executeStatement(sessionHandle, statement, confOverlay, queryTimeout); resp.setOperationHandle(operationHandle.toTOperationHandle()); resp.setStatus(OK_STATUS); } catch (Exception e) { // Note: it's rather important that this (and other methods) catch Exception, not Throwable; // in combination with HiveSessionProxy.invoke code, perhaps unintentionally, it used // to also catch all errors; and now it allows OOMs only to propagate. LOG.warn("Error executing statement: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
TOperationHandle stmtHandle = execResp.getOperationHandle();
public TExecuteStatementResp deepCopy() { return new TExecuteStatementResp(this); }
public void write(org.apache.thrift.protocol.TProtocol oprot, TExecuteStatementResp struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.status != null) { oprot.writeFieldBegin(STATUS_FIELD_DESC); struct.status.write(oprot); oprot.writeFieldEnd(); } if (struct.operationHandle != null) { if (struct.isSetOperationHandle()) { oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC); struct.operationHandle.write(oprot); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TExecuteStatementResp) return this.equals((TExecuteStatementResp)that); return false; }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TExecuteStatementResp struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); BitSet optionals = new BitSet(); if (struct.isSetOperationHandle()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetOperationHandle()) { struct.operationHandle.write(oprot); } }
@Override public TExecuteStatementResp ExecuteStatement(TExecuteStatementReq req) throws TException { TExecuteStatementResp resp = new TExecuteStatementResp(); try { SessionHandle sessionHandle = new SessionHandle(req.getSessionHandle()); String statement = req.getStatement(); Map<String, String> confOverlay = req.getConfOverlay(); Boolean runAsync = req.isRunAsync(); long queryTimeout = req.getQueryTimeout(); OperationHandle operationHandle = runAsync ? cliService.executeStatementAsync(sessionHandle, statement, confOverlay, queryTimeout) : cliService.executeStatement(sessionHandle, statement, confOverlay, queryTimeout); resp.setOperationHandle(operationHandle.toTOperationHandle()); resp.setStatus(OK_STATUS); } catch (Exception e) { // Note: it's rather important that this (and other methods) catch Exception, not Throwable; // in combination with HiveSessionProxy.invoke code, perhaps unintentionally, it used // to also catch all errors; and now it allows OOMs only to propagate. LOG.warn("Error executing statement: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_status = true && (isSetStatus()); list.add(present_status); if (present_status) list.add(status); boolean present_operationHandle = true && (isSetOperationHandle()); list.add(present_operationHandle); if (present_operationHandle) list.add(operationHandle); return list.hashCode(); }
/** * Performs a deep copy on <i>other</i>. */ public ExecuteStatement_result(ExecuteStatement_result other) { if (other.isSetSuccess()) { this.success = new TExecuteStatementResp(other.success); } }
public boolean equals(ExecuteStatement_result that) { if (that == null) return false; boolean this_present_success = true && this.isSetSuccess(); boolean that_present_success = true && that.isSetSuccess(); if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (!this.success.equals(that.success)) return false; } return true; }
@Override public String toString() { StringBuilder sb = new StringBuilder("TExecuteStatementResp("); boolean first = true; sb.append("status:"); if (this.status == null) { sb.append("null"); } else { sb.append(this.status); } first = false; if (isSetOperationHandle()) { if (!first) sb.append(", "); sb.append("operationHandle:"); if (this.operationHandle == null) { sb.append("null"); } else { sb.append(this.operationHandle); } first = false; } sb.append(")"); return sb.toString(); }
private void runAsyncOnServer(String sql) throws SQLException { checkConnection("execute"); reInitState(); TExecuteStatementReq execReq = new TExecuteStatementReq(sessHandle, sql); /** * Run asynchronously whenever possible * Currently only a SQLOperation can be run asynchronously, * in a background operation thread * Compilation can run asynchronously or synchronously and execution run asynchronously */ execReq.setRunAsync(true); execReq.setConfOverlay(sessConf); execReq.setQueryTimeout(queryTimeout); try { TExecuteStatementResp execResp = client.ExecuteStatement(execReq); Utils.verifySuccessWithInfo(execResp.getStatus()); stmtHandle = execResp.getOperationHandle(); isExecuteStatementFailed = false; } catch (SQLException eS) { isExecuteStatementFailed = true; isLogBeingGenerated = false; throw eS; } catch (Exception ex) { isExecuteStatementFailed = true; isLogBeingGenerated = false; throw new SQLException(ex.toString(), "08S01", ex); } }
public boolean equals(TExecuteStatementResp that) { if (that == null) return false; boolean this_present_status = true && this.isSetStatus(); boolean that_present_status = true && that.isSetStatus(); if (this_present_status || that_present_status) { if (!(this_present_status && that_present_status)) return false; if (!this.status.equals(that.status)) return false; } boolean this_present_operationHandle = true && this.isSetOperationHandle(); boolean that_present_operationHandle = true && that.isSetOperationHandle(); if (this_present_operationHandle || that_present_operationHandle) { if (!(this_present_operationHandle && that_present_operationHandle)) return false; if (!this.operationHandle.equals(that.operationHandle)) return false; } return true; }
public void read(org.apache.thrift.protocol.TProtocol iprot, ExecuteStatement_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.success = new TExecuteStatementResp(); struct.success.read(iprot); struct.setSuccessIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); }
private OperationHandle executeStatementInternal(SessionHandle sessionHandle, String statement, Map<String, String> confOverlay, boolean isAsync, long queryTimeout) throws HiveSQLException { try { TExecuteStatementReq req = new TExecuteStatementReq(sessionHandle.toTSessionHandle(), statement); req.setConfOverlay(confOverlay); req.setRunAsync(isAsync); req.setQueryTimeout(queryTimeout); 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); } }
/** * Performs a deep copy on <i>other</i>. */ public TExecuteStatementResp(TExecuteStatementResp other) { if (other.isSetStatus()) { this.status = new TStatus(other.status); } if (other.isSetOperationHandle()) { this.operationHandle = new TOperationHandle(other.operationHandle); } }