Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Autogenerated by Thrift Compiler (0.9.3)
0003  *
0004  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
0005  *  @generated
0006  */
0007 package org.apache.hive.service.rpc.thrift;
0008 
0009 import org.apache.thrift.scheme.IScheme;
0010 import org.apache.thrift.scheme.SchemeFactory;
0011 import org.apache.thrift.scheme.StandardScheme;
0012 
0013 import org.apache.thrift.scheme.TupleScheme;
0014 import org.apache.thrift.protocol.TTupleProtocol;
0015 import org.apache.thrift.protocol.TProtocolException;
0016 import org.apache.thrift.EncodingUtils;
0017 import org.apache.thrift.TException;
0018 import org.apache.thrift.async.AsyncMethodCallback;
0019 import org.apache.thrift.server.AbstractNonblockingServer.*;
0020 import java.util.List;
0021 import java.util.ArrayList;
0022 import java.util.Map;
0023 import java.util.HashMap;
0024 import java.util.EnumMap;
0025 import java.util.Set;
0026 import java.util.HashSet;
0027 import java.util.EnumSet;
0028 import java.util.Collections;
0029 import java.util.BitSet;
0030 import java.nio.ByteBuffer;
0031 import java.util.Arrays;
0032 import javax.annotation.Generated;
0033 import org.slf4j.Logger;
0034 import org.slf4j.LoggerFactory;
0035 
0036 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
0037 @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
0038 public class TFetchResultsReq implements org.apache.thrift.TBase<TFetchResultsReq, TFetchResultsReq._Fields>, java.io.Serializable, Cloneable, Comparable<TFetchResultsReq> {
0039   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TFetchResultsReq");
0040 
0041   private static final org.apache.thrift.protocol.TField OPERATION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationHandle", org.apache.thrift.protocol.TType.STRUCT, (short)1);
0042   private static final org.apache.thrift.protocol.TField ORIENTATION_FIELD_DESC = new org.apache.thrift.protocol.TField("orientation", org.apache.thrift.protocol.TType.I32, (short)2);
0043   private static final org.apache.thrift.protocol.TField MAX_ROWS_FIELD_DESC = new org.apache.thrift.protocol.TField("maxRows", org.apache.thrift.protocol.TType.I64, (short)3);
0044   private static final org.apache.thrift.protocol.TField FETCH_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("fetchType", org.apache.thrift.protocol.TType.I16, (short)4);
0045 
0046   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0047   static {
0048     schemes.put(StandardScheme.class, new TFetchResultsReqStandardSchemeFactory());
0049     schemes.put(TupleScheme.class, new TFetchResultsReqTupleSchemeFactory());
0050   }
0051 
0052   private TOperationHandle operationHandle; // required
0053   private TFetchOrientation orientation; // required
0054   private long maxRows; // required
0055   private short fetchType; // optional
0056 
0057   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0058   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0059     OPERATION_HANDLE((short)1, "operationHandle"),
0060     /**
0061      * 
0062      * @see TFetchOrientation
0063      */
0064     ORIENTATION((short)2, "orientation"),
0065     MAX_ROWS((short)3, "maxRows"),
0066     FETCH_TYPE((short)4, "fetchType");
0067 
0068     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0069 
0070     static {
0071       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0072         byName.put(field.getFieldName(), field);
0073       }
0074     }
0075 
0076     /**
0077      * Find the _Fields constant that matches fieldId, or null if its not found.
0078      */
0079     public static _Fields findByThriftId(int fieldId) {
0080       switch(fieldId) {
0081         case 1: // OPERATION_HANDLE
0082           return OPERATION_HANDLE;
0083         case 2: // ORIENTATION
0084           return ORIENTATION;
0085         case 3: // MAX_ROWS
0086           return MAX_ROWS;
0087         case 4: // FETCH_TYPE
0088           return FETCH_TYPE;
0089         default:
0090           return null;
0091       }
0092     }
0093 
0094     /**
0095      * Find the _Fields constant that matches fieldId, throwing an exception
0096      * if it is not found.
0097      */
0098     public static _Fields findByThriftIdOrThrow(int fieldId) {
0099       _Fields fields = findByThriftId(fieldId);
0100       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0101       return fields;
0102     }
0103 
0104     /**
0105      * Find the _Fields constant that matches name, or null if its not found.
0106      */
0107     public static _Fields findByName(String name) {
0108       return byName.get(name);
0109     }
0110 
0111     private final short _thriftId;
0112     private final String _fieldName;
0113 
0114     _Fields(short thriftId, String fieldName) {
0115       _thriftId = thriftId;
0116       _fieldName = fieldName;
0117     }
0118 
0119     public short getThriftFieldId() {
0120       return _thriftId;
0121     }
0122 
0123     public String getFieldName() {
0124       return _fieldName;
0125     }
0126   }
0127 
0128   // isset id assignments
0129   private static final int __MAXROWS_ISSET_ID = 0;
0130   private static final int __FETCHTYPE_ISSET_ID = 1;
0131   private byte __isset_bitfield = 0;
0132   private static final _Fields optionals[] = {_Fields.FETCH_TYPE};
0133   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0134   static {
0135     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0136     tmpMap.put(_Fields.OPERATION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("operationHandle", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0137         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TOperationHandle.class)));
0138     tmpMap.put(_Fields.ORIENTATION, new org.apache.thrift.meta_data.FieldMetaData("orientation", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0139         new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TFetchOrientation.class)));
0140     tmpMap.put(_Fields.MAX_ROWS, new org.apache.thrift.meta_data.FieldMetaData("maxRows", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0141         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
0142     tmpMap.put(_Fields.FETCH_TYPE, new org.apache.thrift.meta_data.FieldMetaData("fetchType", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
0143         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
0144     metaDataMap = Collections.unmodifiableMap(tmpMap);
0145     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TFetchResultsReq.class, metaDataMap);
0146   }
0147 
0148   public TFetchResultsReq() {
0149     this.orientation = org.apache.hive.service.rpc.thrift.TFetchOrientation.FETCH_NEXT;
0150 
0151     this.fetchType = (short)0;
0152 
0153   }
0154 
0155   public TFetchResultsReq(
0156     TOperationHandle operationHandle,
0157     TFetchOrientation orientation,
0158     long maxRows)
0159   {
0160     this();
0161     this.operationHandle = operationHandle;
0162     this.orientation = orientation;
0163     this.maxRows = maxRows;
0164     setMaxRowsIsSet(true);
0165   }
0166 
0167   /**
0168    * Performs a deep copy on <i>other</i>.
0169    */
0170   public TFetchResultsReq(TFetchResultsReq other) {
0171     __isset_bitfield = other.__isset_bitfield;
0172     if (other.isSetOperationHandle()) {
0173       this.operationHandle = new TOperationHandle(other.operationHandle);
0174     }
0175     if (other.isSetOrientation()) {
0176       this.orientation = other.orientation;
0177     }
0178     this.maxRows = other.maxRows;
0179     this.fetchType = other.fetchType;
0180   }
0181 
0182   public TFetchResultsReq deepCopy() {
0183     return new TFetchResultsReq(this);
0184   }
0185 
0186   @Override
0187   public void clear() {
0188     this.operationHandle = null;
0189     this.orientation = org.apache.hive.service.rpc.thrift.TFetchOrientation.FETCH_NEXT;
0190 
0191     setMaxRowsIsSet(false);
0192     this.maxRows = 0;
0193     this.fetchType = (short)0;
0194 
0195   }
0196 
0197   public TOperationHandle getOperationHandle() {
0198     return this.operationHandle;
0199   }
0200 
0201   public void setOperationHandle(TOperationHandle operationHandle) {
0202     this.operationHandle = operationHandle;
0203   }
0204 
0205   public void unsetOperationHandle() {
0206     this.operationHandle = null;
0207   }
0208 
0209   /** Returns true if field operationHandle is set (has been assigned a value) and false otherwise */
0210   public boolean isSetOperationHandle() {
0211     return this.operationHandle != null;
0212   }
0213 
0214   public void setOperationHandleIsSet(boolean value) {
0215     if (!value) {
0216       this.operationHandle = null;
0217     }
0218   }
0219 
0220   /**
0221    * 
0222    * @see TFetchOrientation
0223    */
0224   public TFetchOrientation getOrientation() {
0225     return this.orientation;
0226   }
0227 
0228   /**
0229    * 
0230    * @see TFetchOrientation
0231    */
0232   public void setOrientation(TFetchOrientation orientation) {
0233     this.orientation = orientation;
0234   }
0235 
0236   public void unsetOrientation() {
0237     this.orientation = null;
0238   }
0239 
0240   /** Returns true if field orientation is set (has been assigned a value) and false otherwise */
0241   public boolean isSetOrientation() {
0242     return this.orientation != null;
0243   }
0244 
0245   public void setOrientationIsSet(boolean value) {
0246     if (!value) {
0247       this.orientation = null;
0248     }
0249   }
0250 
0251   public long getMaxRows() {
0252     return this.maxRows;
0253   }
0254 
0255   public void setMaxRows(long maxRows) {
0256     this.maxRows = maxRows;
0257     setMaxRowsIsSet(true);
0258   }
0259 
0260   public void unsetMaxRows() {
0261     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXROWS_ISSET_ID);
0262   }
0263 
0264   /** Returns true if field maxRows is set (has been assigned a value) and false otherwise */
0265   public boolean isSetMaxRows() {
0266     return EncodingUtils.testBit(__isset_bitfield, __MAXROWS_ISSET_ID);
0267   }
0268 
0269   public void setMaxRowsIsSet(boolean value) {
0270     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXROWS_ISSET_ID, value);
0271   }
0272 
0273   public short getFetchType() {
0274     return this.fetchType;
0275   }
0276 
0277   public void setFetchType(short fetchType) {
0278     this.fetchType = fetchType;
0279     setFetchTypeIsSet(true);
0280   }
0281 
0282   public void unsetFetchType() {
0283     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FETCHTYPE_ISSET_ID);
0284   }
0285 
0286   /** Returns true if field fetchType is set (has been assigned a value) and false otherwise */
0287   public boolean isSetFetchType() {
0288     return EncodingUtils.testBit(__isset_bitfield, __FETCHTYPE_ISSET_ID);
0289   }
0290 
0291   public void setFetchTypeIsSet(boolean value) {
0292     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FETCHTYPE_ISSET_ID, value);
0293   }
0294 
0295   public void setFieldValue(_Fields field, Object value) {
0296     switch (field) {
0297     case OPERATION_HANDLE:
0298       if (value == null) {
0299         unsetOperationHandle();
0300       } else {
0301         setOperationHandle((TOperationHandle)value);
0302       }
0303       break;
0304 
0305     case ORIENTATION:
0306       if (value == null) {
0307         unsetOrientation();
0308       } else {
0309         setOrientation((TFetchOrientation)value);
0310       }
0311       break;
0312 
0313     case MAX_ROWS:
0314       if (value == null) {
0315         unsetMaxRows();
0316       } else {
0317         setMaxRows((Long)value);
0318       }
0319       break;
0320 
0321     case FETCH_TYPE:
0322       if (value == null) {
0323         unsetFetchType();
0324       } else {
0325         setFetchType((Short)value);
0326       }
0327       break;
0328 
0329     }
0330   }
0331 
0332   public Object getFieldValue(_Fields field) {
0333     switch (field) {
0334     case OPERATION_HANDLE:
0335       return getOperationHandle();
0336 
0337     case ORIENTATION:
0338       return getOrientation();
0339 
0340     case MAX_ROWS:
0341       return getMaxRows();
0342 
0343     case FETCH_TYPE:
0344       return getFetchType();
0345 
0346     }
0347     throw new IllegalStateException();
0348   }
0349 
0350   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0351   public boolean isSet(_Fields field) {
0352     if (field == null) {
0353       throw new IllegalArgumentException();
0354     }
0355 
0356     switch (field) {
0357     case OPERATION_HANDLE:
0358       return isSetOperationHandle();
0359     case ORIENTATION:
0360       return isSetOrientation();
0361     case MAX_ROWS:
0362       return isSetMaxRows();
0363     case FETCH_TYPE:
0364       return isSetFetchType();
0365     }
0366     throw new IllegalStateException();
0367   }
0368 
0369   @Override
0370   public boolean equals(Object that) {
0371     if (that == null)
0372       return false;
0373     if (that instanceof TFetchResultsReq)
0374       return this.equals((TFetchResultsReq)that);
0375     return false;
0376   }
0377 
0378   public boolean equals(TFetchResultsReq that) {
0379     if (that == null)
0380       return false;
0381 
0382     boolean this_present_operationHandle = true && this.isSetOperationHandle();
0383     boolean that_present_operationHandle = true && that.isSetOperationHandle();
0384     if (this_present_operationHandle || that_present_operationHandle) {
0385       if (!(this_present_operationHandle && that_present_operationHandle))
0386         return false;
0387       if (!this.operationHandle.equals(that.operationHandle))
0388         return false;
0389     }
0390 
0391     boolean this_present_orientation = true && this.isSetOrientation();
0392     boolean that_present_orientation = true && that.isSetOrientation();
0393     if (this_present_orientation || that_present_orientation) {
0394       if (!(this_present_orientation && that_present_orientation))
0395         return false;
0396       if (!this.orientation.equals(that.orientation))
0397         return false;
0398     }
0399 
0400     boolean this_present_maxRows = true;
0401     boolean that_present_maxRows = true;
0402     if (this_present_maxRows || that_present_maxRows) {
0403       if (!(this_present_maxRows && that_present_maxRows))
0404         return false;
0405       if (this.maxRows != that.maxRows)
0406         return false;
0407     }
0408 
0409     boolean this_present_fetchType = true && this.isSetFetchType();
0410     boolean that_present_fetchType = true && that.isSetFetchType();
0411     if (this_present_fetchType || that_present_fetchType) {
0412       if (!(this_present_fetchType && that_present_fetchType))
0413         return false;
0414       if (this.fetchType != that.fetchType)
0415         return false;
0416     }
0417 
0418     return true;
0419   }
0420 
0421   @Override
0422   public int hashCode() {
0423     List<Object> list = new ArrayList<Object>();
0424 
0425     boolean present_operationHandle = true && (isSetOperationHandle());
0426     list.add(present_operationHandle);
0427     if (present_operationHandle)
0428       list.add(operationHandle);
0429 
0430     boolean present_orientation = true && (isSetOrientation());
0431     list.add(present_orientation);
0432     if (present_orientation)
0433       list.add(orientation.getValue());
0434 
0435     boolean present_maxRows = true;
0436     list.add(present_maxRows);
0437     if (present_maxRows)
0438       list.add(maxRows);
0439 
0440     boolean present_fetchType = true && (isSetFetchType());
0441     list.add(present_fetchType);
0442     if (present_fetchType)
0443       list.add(fetchType);
0444 
0445     return list.hashCode();
0446   }
0447 
0448   @Override
0449   public int compareTo(TFetchResultsReq other) {
0450     if (!getClass().equals(other.getClass())) {
0451       return getClass().getName().compareTo(other.getClass().getName());
0452     }
0453 
0454     int lastComparison = 0;
0455 
0456     lastComparison = Boolean.valueOf(isSetOperationHandle()).compareTo(other.isSetOperationHandle());
0457     if (lastComparison != 0) {
0458       return lastComparison;
0459     }
0460     if (isSetOperationHandle()) {
0461       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationHandle, other.operationHandle);
0462       if (lastComparison != 0) {
0463         return lastComparison;
0464       }
0465     }
0466     lastComparison = Boolean.valueOf(isSetOrientation()).compareTo(other.isSetOrientation());
0467     if (lastComparison != 0) {
0468       return lastComparison;
0469     }
0470     if (isSetOrientation()) {
0471       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.orientation, other.orientation);
0472       if (lastComparison != 0) {
0473         return lastComparison;
0474       }
0475     }
0476     lastComparison = Boolean.valueOf(isSetMaxRows()).compareTo(other.isSetMaxRows());
0477     if (lastComparison != 0) {
0478       return lastComparison;
0479     }
0480     if (isSetMaxRows()) {
0481       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxRows, other.maxRows);
0482       if (lastComparison != 0) {
0483         return lastComparison;
0484       }
0485     }
0486     lastComparison = Boolean.valueOf(isSetFetchType()).compareTo(other.isSetFetchType());
0487     if (lastComparison != 0) {
0488       return lastComparison;
0489     }
0490     if (isSetFetchType()) {
0491       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fetchType, other.fetchType);
0492       if (lastComparison != 0) {
0493         return lastComparison;
0494       }
0495     }
0496     return 0;
0497   }
0498 
0499   public _Fields fieldForId(int fieldId) {
0500     return _Fields.findByThriftId(fieldId);
0501   }
0502 
0503   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0504     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0505   }
0506 
0507   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0508     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0509   }
0510 
0511   @Override
0512   public String toString() {
0513     StringBuilder sb = new StringBuilder("TFetchResultsReq(");
0514     boolean first = true;
0515 
0516     sb.append("operationHandle:");
0517     if (this.operationHandle == null) {
0518       sb.append("null");
0519     } else {
0520       sb.append(this.operationHandle);
0521     }
0522     first = false;
0523     if (!first) sb.append(", ");
0524     sb.append("orientation:");
0525     if (this.orientation == null) {
0526       sb.append("null");
0527     } else {
0528       sb.append(this.orientation);
0529     }
0530     first = false;
0531     if (!first) sb.append(", ");
0532     sb.append("maxRows:");
0533     sb.append(this.maxRows);
0534     first = false;
0535     if (isSetFetchType()) {
0536       if (!first) sb.append(", ");
0537       sb.append("fetchType:");
0538       sb.append(this.fetchType);
0539       first = false;
0540     }
0541     sb.append(")");
0542     return sb.toString();
0543   }
0544 
0545   public void validate() throws org.apache.thrift.TException {
0546     // check for required fields
0547     if (!isSetOperationHandle()) {
0548       throw new org.apache.thrift.protocol.TProtocolException("Required field 'operationHandle' is unset! Struct:" + toString());
0549     }
0550 
0551     if (!isSetOrientation()) {
0552       throw new org.apache.thrift.protocol.TProtocolException("Required field 'orientation' is unset! Struct:" + toString());
0553     }
0554 
0555     if (!isSetMaxRows()) {
0556       throw new org.apache.thrift.protocol.TProtocolException("Required field 'maxRows' is unset! Struct:" + toString());
0557     }
0558 
0559     // check for sub-struct validity
0560     if (operationHandle != null) {
0561       operationHandle.validate();
0562     }
0563   }
0564 
0565   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0566     try {
0567       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0568     } catch (org.apache.thrift.TException te) {
0569       throw new java.io.IOException(te);
0570     }
0571   }
0572 
0573   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0574     try {
0575       // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
0576       __isset_bitfield = 0;
0577       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0578     } catch (org.apache.thrift.TException te) {
0579       throw new java.io.IOException(te);
0580     }
0581   }
0582 
0583   private static class TFetchResultsReqStandardSchemeFactory implements SchemeFactory {
0584     public TFetchResultsReqStandardScheme getScheme() {
0585       return new TFetchResultsReqStandardScheme();
0586     }
0587   }
0588 
0589   private static class TFetchResultsReqStandardScheme extends StandardScheme<TFetchResultsReq> {
0590 
0591     public void read(org.apache.thrift.protocol.TProtocol iprot, TFetchResultsReq struct) throws org.apache.thrift.TException {
0592       org.apache.thrift.protocol.TField schemeField;
0593       iprot.readStructBegin();
0594       while (true)
0595       {
0596         schemeField = iprot.readFieldBegin();
0597         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0598           break;
0599         }
0600         switch (schemeField.id) {
0601           case 1: // OPERATION_HANDLE
0602             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0603               struct.operationHandle = new TOperationHandle();
0604               struct.operationHandle.read(iprot);
0605               struct.setOperationHandleIsSet(true);
0606             } else { 
0607               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0608             }
0609             break;
0610           case 2: // ORIENTATION
0611             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
0612               struct.orientation = org.apache.hive.service.rpc.thrift.TFetchOrientation.findByValue(iprot.readI32());
0613               struct.setOrientationIsSet(true);
0614             } else { 
0615               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0616             }
0617             break;
0618           case 3: // MAX_ROWS
0619             if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
0620               struct.maxRows = iprot.readI64();
0621               struct.setMaxRowsIsSet(true);
0622             } else { 
0623               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0624             }
0625             break;
0626           case 4: // FETCH_TYPE
0627             if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
0628               struct.fetchType = iprot.readI16();
0629               struct.setFetchTypeIsSet(true);
0630             } else { 
0631               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0632             }
0633             break;
0634           default:
0635             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0636         }
0637         iprot.readFieldEnd();
0638       }
0639       iprot.readStructEnd();
0640       struct.validate();
0641     }
0642 
0643     public void write(org.apache.thrift.protocol.TProtocol oprot, TFetchResultsReq struct) throws org.apache.thrift.TException {
0644       struct.validate();
0645 
0646       oprot.writeStructBegin(STRUCT_DESC);
0647       if (struct.operationHandle != null) {
0648         oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC);
0649         struct.operationHandle.write(oprot);
0650         oprot.writeFieldEnd();
0651       }
0652       if (struct.orientation != null) {
0653         oprot.writeFieldBegin(ORIENTATION_FIELD_DESC);
0654         oprot.writeI32(struct.orientation.getValue());
0655         oprot.writeFieldEnd();
0656       }
0657       oprot.writeFieldBegin(MAX_ROWS_FIELD_DESC);
0658       oprot.writeI64(struct.maxRows);
0659       oprot.writeFieldEnd();
0660       if (struct.isSetFetchType()) {
0661         oprot.writeFieldBegin(FETCH_TYPE_FIELD_DESC);
0662         oprot.writeI16(struct.fetchType);
0663         oprot.writeFieldEnd();
0664       }
0665       oprot.writeFieldStop();
0666       oprot.writeStructEnd();
0667     }
0668 
0669   }
0670 
0671   private static class TFetchResultsReqTupleSchemeFactory implements SchemeFactory {
0672     public TFetchResultsReqTupleScheme getScheme() {
0673       return new TFetchResultsReqTupleScheme();
0674     }
0675   }
0676 
0677   private static class TFetchResultsReqTupleScheme extends TupleScheme<TFetchResultsReq> {
0678 
0679     @Override
0680     public void write(org.apache.thrift.protocol.TProtocol prot, TFetchResultsReq struct) throws org.apache.thrift.TException {
0681       TTupleProtocol oprot = (TTupleProtocol) prot;
0682       struct.operationHandle.write(oprot);
0683       oprot.writeI32(struct.orientation.getValue());
0684       oprot.writeI64(struct.maxRows);
0685       BitSet optionals = new BitSet();
0686       if (struct.isSetFetchType()) {
0687         optionals.set(0);
0688       }
0689       oprot.writeBitSet(optionals, 1);
0690       if (struct.isSetFetchType()) {
0691         oprot.writeI16(struct.fetchType);
0692       }
0693     }
0694 
0695     @Override
0696     public void read(org.apache.thrift.protocol.TProtocol prot, TFetchResultsReq struct) throws org.apache.thrift.TException {
0697       TTupleProtocol iprot = (TTupleProtocol) prot;
0698       struct.operationHandle = new TOperationHandle();
0699       struct.operationHandle.read(iprot);
0700       struct.setOperationHandleIsSet(true);
0701       struct.orientation = org.apache.hive.service.rpc.thrift.TFetchOrientation.findByValue(iprot.readI32());
0702       struct.setOrientationIsSet(true);
0703       struct.maxRows = iprot.readI64();
0704       struct.setMaxRowsIsSet(true);
0705       BitSet incoming = iprot.readBitSet(1);
0706       if (incoming.get(0)) {
0707         struct.fetchType = iprot.readI16();
0708         struct.setFetchTypeIsSet(true);
0709       }
0710     }
0711   }
0712 
0713 }
0714