/** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.hive.service.cli.thrift; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TGetOperationStatusResp implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetOperationStatusResp"); private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final org.apache.thrift.protocol.TField OPERATION_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationState", org.apache.thrift.protocol.TType.I32, (short)2); private static final org.apache.thrift.protocol.TField SQL_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("sqlState", org.apache.thrift.protocol.TType.STRING, (short)3); private static final org.apache.thrift.protocol.TField ERROR_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("errorCode", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField ERROR_MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("errorMessage", org.apache.thrift.protocol.TType.STRING, (short)5); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { schemes.put(StandardScheme.class, new TGetOperationStatusRespStandardSchemeFactory()); schemes.put(TupleScheme.class, new TGetOperationStatusRespTupleSchemeFactory()); } private TStatus status; // required private TOperationState operationState; // optional private String sqlState; // optional private int errorCode; // optional private String errorMessage; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { STATUS((short)1, "status"), /** * * @see TOperationState */ OPERATION_STATE((short)2, "operationState"), SQL_STATE((short)3, "sqlState"), ERROR_CODE((short)4, "errorCode"), ERROR_MESSAGE((short)5, "errorMessage"); private static final Map byName = new HashMap(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // STATUS return STATUS; case 2: // OPERATION_STATE return OPERATION_STATE; case 3: // SQL_STATE return SQL_STATE; case 4: // ERROR_CODE return ERROR_CODE; case 5: // ERROR_MESSAGE return ERROR_MESSAGE; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __ERRORCODE_ISSET_ID = 0; private byte __isset_bitfield = 0; private _Fields optionals[] = {_Fields.OPERATION_STATE,_Fields.SQL_STATE,_Fields.ERROR_CODE,_Fields.ERROR_MESSAGE}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStatus.class))); tmpMap.put(_Fields.OPERATION_STATE, new org.apache.thrift.meta_data.FieldMetaData("operationState", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TOperationState.class))); tmpMap.put(_Fields.SQL_STATE, new org.apache.thrift.meta_data.FieldMetaData("sqlState", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.ERROR_CODE, new org.apache.thrift.meta_data.FieldMetaData("errorCode", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.ERROR_MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("errorMessage", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetOperationStatusResp.class, metaDataMap); } public TGetOperationStatusResp() { } public TGetOperationStatusResp( TStatus status) { this(); this.status = status; } /** * Performs a deep copy on other. */ public TGetOperationStatusResp(TGetOperationStatusResp other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetStatus()) { this.status = new TStatus(other.status); } if (other.isSetOperationState()) { this.operationState = other.operationState; } if (other.isSetSqlState()) { this.sqlState = other.sqlState; } this.errorCode = other.errorCode; if (other.isSetErrorMessage()) { this.errorMessage = other.errorMessage; } } public TGetOperationStatusResp deepCopy() { return new TGetOperationStatusResp(this); } @Override public void clear() { this.status = null; this.operationState = null; this.sqlState = null; setErrorCodeIsSet(false); this.errorCode = 0; this.errorMessage = null; } public TStatus getStatus() { return this.status; } public void setStatus(TStatus status) { this.status = status; } public void unsetStatus() { this.status = null; } /** Returns true if field status is set (has been assigned a value) and false otherwise */ public boolean isSetStatus() { return this.status != null; } public void setStatusIsSet(boolean value) { if (!value) { this.status = null; } } /** * * @see TOperationState */ public TOperationState getOperationState() { return this.operationState; } /** * * @see TOperationState */ public void setOperationState(TOperationState operationState) { this.operationState = operationState; } public void unsetOperationState() { this.operationState = null; } /** Returns true if field operationState is set (has been assigned a value) and false otherwise */ public boolean isSetOperationState() { return this.operationState != null; } public void setOperationStateIsSet(boolean value) { if (!value) { this.operationState = null; } } public String getSqlState() { return this.sqlState; } public void setSqlState(String sqlState) { this.sqlState = sqlState; } public void unsetSqlState() { this.sqlState = null; } /** Returns true if field sqlState is set (has been assigned a value) and false otherwise */ public boolean isSetSqlState() { return this.sqlState != null; } public void setSqlStateIsSet(boolean value) { if (!value) { this.sqlState = null; } } public int getErrorCode() { return this.errorCode; } public void setErrorCode(int errorCode) { this.errorCode = errorCode; setErrorCodeIsSet(true); } public void unsetErrorCode() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ERRORCODE_ISSET_ID); } /** Returns true if field errorCode is set (has been assigned a value) and false otherwise */ public boolean isSetErrorCode() { return EncodingUtils.testBit(__isset_bitfield, __ERRORCODE_ISSET_ID); } public void setErrorCodeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ERRORCODE_ISSET_ID, value); } public String getErrorMessage() { return this.errorMessage; } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public void unsetErrorMessage() { this.errorMessage = null; } /** Returns true if field errorMessage is set (has been assigned a value) and false otherwise */ public boolean isSetErrorMessage() { return this.errorMessage != null; } public void setErrorMessageIsSet(boolean value) { if (!value) { this.errorMessage = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case STATUS: if (value == null) { unsetStatus(); } else { setStatus((TStatus)value); } break; case OPERATION_STATE: if (value == null) { unsetOperationState(); } else { setOperationState((TOperationState)value); } break; case SQL_STATE: if (value == null) { unsetSqlState(); } else { setSqlState((String)value); } break; case ERROR_CODE: if (value == null) { unsetErrorCode(); } else { setErrorCode((Integer)value); } break; case ERROR_MESSAGE: if (value == null) { unsetErrorMessage(); } else { setErrorMessage((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case STATUS: return getStatus(); case OPERATION_STATE: return getOperationState(); case SQL_STATE: return getSqlState(); case ERROR_CODE: return Integer.valueOf(getErrorCode()); case ERROR_MESSAGE: return getErrorMessage(); } throw new IllegalStateException(); } /** 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_STATE: return isSetOperationState(); case SQL_STATE: return isSetSqlState(); case ERROR_CODE: return isSetErrorCode(); case ERROR_MESSAGE: return isSetErrorMessage(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TGetOperationStatusResp) return this.equals((TGetOperationStatusResp)that); return false; } public boolean equals(TGetOperationStatusResp 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_operationState = true && this.isSetOperationState(); boolean that_present_operationState = true && that.isSetOperationState(); if (this_present_operationState || that_present_operationState) { if (!(this_present_operationState && that_present_operationState)) return false; if (!this.operationState.equals(that.operationState)) return false; } boolean this_present_sqlState = true && this.isSetSqlState(); boolean that_present_sqlState = true && that.isSetSqlState(); if (this_present_sqlState || that_present_sqlState) { if (!(this_present_sqlState && that_present_sqlState)) return false; if (!this.sqlState.equals(that.sqlState)) return false; } boolean this_present_errorCode = true && this.isSetErrorCode(); boolean that_present_errorCode = true && that.isSetErrorCode(); if (this_present_errorCode || that_present_errorCode) { if (!(this_present_errorCode && that_present_errorCode)) return false; if (this.errorCode != that.errorCode) return false; } boolean this_present_errorMessage = true && this.isSetErrorMessage(); boolean that_present_errorMessage = true && that.isSetErrorMessage(); if (this_present_errorMessage || that_present_errorMessage) { if (!(this_present_errorMessage && that_present_errorMessage)) return false; if (!this.errorMessage.equals(that.errorMessage)) return false; } return true; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_status = true && (isSetStatus()); builder.append(present_status); if (present_status) builder.append(status); boolean present_operationState = true && (isSetOperationState()); builder.append(present_operationState); if (present_operationState) builder.append(operationState.getValue()); boolean present_sqlState = true && (isSetSqlState()); builder.append(present_sqlState); if (present_sqlState) builder.append(sqlState); boolean present_errorCode = true && (isSetErrorCode()); builder.append(present_errorCode); if (present_errorCode) builder.append(errorCode); boolean present_errorMessage = true && (isSetErrorMessage()); builder.append(present_errorMessage); if (present_errorMessage) builder.append(errorMessage); return builder.toHashCode(); } public int compareTo(TGetOperationStatusResp other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; TGetOperationStatusResp typedOther = (TGetOperationStatusResp)other; lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus()); if (lastComparison != 0) { return lastComparison; } if (isSetStatus()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetOperationState()).compareTo(typedOther.isSetOperationState()); if (lastComparison != 0) { return lastComparison; } if (isSetOperationState()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationState, typedOther.operationState); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSqlState()).compareTo(typedOther.isSetSqlState()); if (lastComparison != 0) { return lastComparison; } if (isSetSqlState()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sqlState, typedOther.sqlState); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetErrorCode()).compareTo(typedOther.isSetErrorCode()); if (lastComparison != 0) { return lastComparison; } if (isSetErrorCode()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errorCode, typedOther.errorCode); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetErrorMessage()).compareTo(typedOther.isSetErrorMessage()); if (lastComparison != 0) { return lastComparison; } if (isSetErrorMessage()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errorMessage, typedOther.errorMessage); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("TGetOperationStatusResp("); boolean first = true; sb.append("status:"); if (this.status == null) { sb.append("null"); } else { sb.append(this.status); } first = false; if (isSetOperationState()) { if (!first) sb.append(", "); sb.append("operationState:"); if (this.operationState == null) { sb.append("null"); } else { sb.append(this.operationState); } first = false; } if (isSetSqlState()) { if (!first) sb.append(", "); sb.append("sqlState:"); if (this.sqlState == null) { sb.append("null"); } else { sb.append(this.sqlState); } first = false; } if (isSetErrorCode()) { if (!first) sb.append(", "); sb.append("errorCode:"); sb.append(this.errorCode); first = false; } if (isSetErrorMessage()) { if (!first) sb.append(", "); sb.append("errorMessage:"); if (this.errorMessage == null) { sb.append("null"); } else { sb.append(this.errorMessage); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetStatus()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString()); } // check for sub-struct validity if (status != null) { status.validate(); } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class TGetOperationStatusRespStandardSchemeFactory implements SchemeFactory { public TGetOperationStatusRespStandardScheme getScheme() { return new TGetOperationStatusRespStandardScheme(); } } private static class TGetOperationStatusRespStandardScheme extends StandardScheme { public void read(org.apache.thrift.protocol.TProtocol iprot, TGetOperationStatusResp 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 1: // STATUS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.status = new TStatus(); struct.status.read(iprot); struct.setStatusIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // OPERATION_STATE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.operationState = TOperationState.findByValue(iprot.readI32()); struct.setOperationStateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // SQL_STATE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.sqlState = iprot.readString(); struct.setSqlStateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // ERROR_CODE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.errorCode = iprot.readI32(); struct.setErrorCodeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // ERROR_MESSAGE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.errorMessage = iprot.readString(); struct.setErrorMessageIsSet(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(); } public void write(org.apache.thrift.protocol.TProtocol oprot, TGetOperationStatusResp 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.operationState != null) { if (struct.isSetOperationState()) { oprot.writeFieldBegin(OPERATION_STATE_FIELD_DESC); oprot.writeI32(struct.operationState.getValue()); oprot.writeFieldEnd(); } } if (struct.sqlState != null) { if (struct.isSetSqlState()) { oprot.writeFieldBegin(SQL_STATE_FIELD_DESC); oprot.writeString(struct.sqlState); oprot.writeFieldEnd(); } } if (struct.isSetErrorCode()) { oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC); oprot.writeI32(struct.errorCode); oprot.writeFieldEnd(); } if (struct.errorMessage != null) { if (struct.isSetErrorMessage()) { oprot.writeFieldBegin(ERROR_MESSAGE_FIELD_DESC); oprot.writeString(struct.errorMessage); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class TGetOperationStatusRespTupleSchemeFactory implements SchemeFactory { public TGetOperationStatusRespTupleScheme getScheme() { return new TGetOperationStatusRespTupleScheme(); } } private static class TGetOperationStatusRespTupleScheme extends TupleScheme { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TGetOperationStatusResp struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); BitSet optionals = new BitSet(); if (struct.isSetOperationState()) { optionals.set(0); } if (struct.isSetSqlState()) { optionals.set(1); } if (struct.isSetErrorCode()) { optionals.set(2); } if (struct.isSetErrorMessage()) { optionals.set(3); } oprot.writeBitSet(optionals, 4); if (struct.isSetOperationState()) { oprot.writeI32(struct.operationState.getValue()); } if (struct.isSetSqlState()) { oprot.writeString(struct.sqlState); } if (struct.isSetErrorCode()) { oprot.writeI32(struct.errorCode); } if (struct.isSetErrorMessage()) { oprot.writeString(struct.errorMessage); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, TGetOperationStatusResp struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.status = new TStatus(); struct.status.read(iprot); struct.setStatusIsSet(true); BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { struct.operationState = TOperationState.findByValue(iprot.readI32()); struct.setOperationStateIsSet(true); } if (incoming.get(1)) { struct.sqlState = iprot.readString(); struct.setSqlStateIsSet(true); } if (incoming.get(2)) { struct.errorCode = iprot.readI32(); struct.setErrorCodeIsSet(true); } if (incoming.get(3)) { struct.errorMessage = iprot.readString(); struct.setErrorMessageIsSet(true); } } } }