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 TTableSchema implements org.apache.thrift.TBase<TTableSchema, TTableSchema._Fields>, java.io.Serializable, Cloneable, Comparable<TTableSchema> {
0039   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTableSchema");
0040 
0041   private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)1);
0042 
0043   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0044   static {
0045     schemes.put(StandardScheme.class, new TTableSchemaStandardSchemeFactory());
0046     schemes.put(TupleScheme.class, new TTableSchemaTupleSchemeFactory());
0047   }
0048 
0049   private List<TColumnDesc> columns; // required
0050 
0051   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0052   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053     COLUMNS((short)1, "columns");
0054 
0055     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0056 
0057     static {
0058       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0059         byName.put(field.getFieldName(), field);
0060       }
0061     }
0062 
0063     /**
0064      * Find the _Fields constant that matches fieldId, or null if its not found.
0065      */
0066     public static _Fields findByThriftId(int fieldId) {
0067       switch(fieldId) {
0068         case 1: // COLUMNS
0069           return COLUMNS;
0070         default:
0071           return null;
0072       }
0073     }
0074 
0075     /**
0076      * Find the _Fields constant that matches fieldId, throwing an exception
0077      * if it is not found.
0078      */
0079     public static _Fields findByThriftIdOrThrow(int fieldId) {
0080       _Fields fields = findByThriftId(fieldId);
0081       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0082       return fields;
0083     }
0084 
0085     /**
0086      * Find the _Fields constant that matches name, or null if its not found.
0087      */
0088     public static _Fields findByName(String name) {
0089       return byName.get(name);
0090     }
0091 
0092     private final short _thriftId;
0093     private final String _fieldName;
0094 
0095     _Fields(short thriftId, String fieldName) {
0096       _thriftId = thriftId;
0097       _fieldName = fieldName;
0098     }
0099 
0100     public short getThriftFieldId() {
0101       return _thriftId;
0102     }
0103 
0104     public String getFieldName() {
0105       return _fieldName;
0106     }
0107   }
0108 
0109   // isset id assignments
0110   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0111   static {
0112     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0113     tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0114         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
0115             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TColumnDesc.class))));
0116     metaDataMap = Collections.unmodifiableMap(tmpMap);
0117     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTableSchema.class, metaDataMap);
0118   }
0119 
0120   public TTableSchema() {
0121   }
0122 
0123   public TTableSchema(
0124     List<TColumnDesc> columns)
0125   {
0126     this();
0127     this.columns = columns;
0128   }
0129 
0130   /**
0131    * Performs a deep copy on <i>other</i>.
0132    */
0133   public TTableSchema(TTableSchema other) {
0134     if (other.isSetColumns()) {
0135       List<TColumnDesc> __this__columns = new ArrayList<TColumnDesc>(other.columns.size());
0136       for (TColumnDesc other_element : other.columns) {
0137         __this__columns.add(new TColumnDesc(other_element));
0138       }
0139       this.columns = __this__columns;
0140     }
0141   }
0142 
0143   public TTableSchema deepCopy() {
0144     return new TTableSchema(this);
0145   }
0146 
0147   @Override
0148   public void clear() {
0149     this.columns = null;
0150   }
0151 
0152   public int getColumnsSize() {
0153     return (this.columns == null) ? 0 : this.columns.size();
0154   }
0155 
0156   public java.util.Iterator<TColumnDesc> getColumnsIterator() {
0157     return (this.columns == null) ? null : this.columns.iterator();
0158   }
0159 
0160   public void addToColumns(TColumnDesc elem) {
0161     if (this.columns == null) {
0162       this.columns = new ArrayList<TColumnDesc>();
0163     }
0164     this.columns.add(elem);
0165   }
0166 
0167   public List<TColumnDesc> getColumns() {
0168     return this.columns;
0169   }
0170 
0171   public void setColumns(List<TColumnDesc> columns) {
0172     this.columns = columns;
0173   }
0174 
0175   public void unsetColumns() {
0176     this.columns = null;
0177   }
0178 
0179   /** Returns true if field columns is set (has been assigned a value) and false otherwise */
0180   public boolean isSetColumns() {
0181     return this.columns != null;
0182   }
0183 
0184   public void setColumnsIsSet(boolean value) {
0185     if (!value) {
0186       this.columns = null;
0187     }
0188   }
0189 
0190   public void setFieldValue(_Fields field, Object value) {
0191     switch (field) {
0192     case COLUMNS:
0193       if (value == null) {
0194         unsetColumns();
0195       } else {
0196         setColumns((List<TColumnDesc>)value);
0197       }
0198       break;
0199 
0200     }
0201   }
0202 
0203   public Object getFieldValue(_Fields field) {
0204     switch (field) {
0205     case COLUMNS:
0206       return getColumns();
0207 
0208     }
0209     throw new IllegalStateException();
0210   }
0211 
0212   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0213   public boolean isSet(_Fields field) {
0214     if (field == null) {
0215       throw new IllegalArgumentException();
0216     }
0217 
0218     switch (field) {
0219     case COLUMNS:
0220       return isSetColumns();
0221     }
0222     throw new IllegalStateException();
0223   }
0224 
0225   @Override
0226   public boolean equals(Object that) {
0227     if (that == null)
0228       return false;
0229     if (that instanceof TTableSchema)
0230       return this.equals((TTableSchema)that);
0231     return false;
0232   }
0233 
0234   public boolean equals(TTableSchema that) {
0235     if (that == null)
0236       return false;
0237 
0238     boolean this_present_columns = true && this.isSetColumns();
0239     boolean that_present_columns = true && that.isSetColumns();
0240     if (this_present_columns || that_present_columns) {
0241       if (!(this_present_columns && that_present_columns))
0242         return false;
0243       if (!this.columns.equals(that.columns))
0244         return false;
0245     }
0246 
0247     return true;
0248   }
0249 
0250   @Override
0251   public int hashCode() {
0252     List<Object> list = new ArrayList<Object>();
0253 
0254     boolean present_columns = true && (isSetColumns());
0255     list.add(present_columns);
0256     if (present_columns)
0257       list.add(columns);
0258 
0259     return list.hashCode();
0260   }
0261 
0262   @Override
0263   public int compareTo(TTableSchema other) {
0264     if (!getClass().equals(other.getClass())) {
0265       return getClass().getName().compareTo(other.getClass().getName());
0266     }
0267 
0268     int lastComparison = 0;
0269 
0270     lastComparison = Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
0271     if (lastComparison != 0) {
0272       return lastComparison;
0273     }
0274     if (isSetColumns()) {
0275       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
0276       if (lastComparison != 0) {
0277         return lastComparison;
0278       }
0279     }
0280     return 0;
0281   }
0282 
0283   public _Fields fieldForId(int fieldId) {
0284     return _Fields.findByThriftId(fieldId);
0285   }
0286 
0287   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0288     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0289   }
0290 
0291   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0292     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0293   }
0294 
0295   @Override
0296   public String toString() {
0297     StringBuilder sb = new StringBuilder("TTableSchema(");
0298     boolean first = true;
0299 
0300     sb.append("columns:");
0301     if (this.columns == null) {
0302       sb.append("null");
0303     } else {
0304       sb.append(this.columns);
0305     }
0306     first = false;
0307     sb.append(")");
0308     return sb.toString();
0309   }
0310 
0311   public void validate() throws org.apache.thrift.TException {
0312     // check for required fields
0313     if (!isSetColumns()) {
0314       throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' is unset! Struct:" + toString());
0315     }
0316 
0317     // check for sub-struct validity
0318   }
0319 
0320   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0321     try {
0322       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0323     } catch (org.apache.thrift.TException te) {
0324       throw new java.io.IOException(te);
0325     }
0326   }
0327 
0328   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0329     try {
0330       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0331     } catch (org.apache.thrift.TException te) {
0332       throw new java.io.IOException(te);
0333     }
0334   }
0335 
0336   private static class TTableSchemaStandardSchemeFactory implements SchemeFactory {
0337     public TTableSchemaStandardScheme getScheme() {
0338       return new TTableSchemaStandardScheme();
0339     }
0340   }
0341 
0342   private static class TTableSchemaStandardScheme extends StandardScheme<TTableSchema> {
0343 
0344     public void read(org.apache.thrift.protocol.TProtocol iprot, TTableSchema struct) throws org.apache.thrift.TException {
0345       org.apache.thrift.protocol.TField schemeField;
0346       iprot.readStructBegin();
0347       while (true)
0348       {
0349         schemeField = iprot.readFieldBegin();
0350         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0351           break;
0352         }
0353         switch (schemeField.id) {
0354           case 1: // COLUMNS
0355             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
0356               {
0357                 org.apache.thrift.protocol.TList _list38 = iprot.readListBegin();
0358                 struct.columns = new ArrayList<TColumnDesc>(_list38.size);
0359                 TColumnDesc _elem39;
0360                 for (int _i40 = 0; _i40 < _list38.size; ++_i40)
0361                 {
0362                   _elem39 = new TColumnDesc();
0363                   _elem39.read(iprot);
0364                   struct.columns.add(_elem39);
0365                 }
0366                 iprot.readListEnd();
0367               }
0368               struct.setColumnsIsSet(true);
0369             } else { 
0370               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0371             }
0372             break;
0373           default:
0374             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0375         }
0376         iprot.readFieldEnd();
0377       }
0378       iprot.readStructEnd();
0379       struct.validate();
0380     }
0381 
0382     public void write(org.apache.thrift.protocol.TProtocol oprot, TTableSchema struct) throws org.apache.thrift.TException {
0383       struct.validate();
0384 
0385       oprot.writeStructBegin(STRUCT_DESC);
0386       if (struct.columns != null) {
0387         oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
0388         {
0389           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
0390           for (TColumnDesc _iter41 : struct.columns)
0391           {
0392             _iter41.write(oprot);
0393           }
0394           oprot.writeListEnd();
0395         }
0396         oprot.writeFieldEnd();
0397       }
0398       oprot.writeFieldStop();
0399       oprot.writeStructEnd();
0400     }
0401 
0402   }
0403 
0404   private static class TTableSchemaTupleSchemeFactory implements SchemeFactory {
0405     public TTableSchemaTupleScheme getScheme() {
0406       return new TTableSchemaTupleScheme();
0407     }
0408   }
0409 
0410   private static class TTableSchemaTupleScheme extends TupleScheme<TTableSchema> {
0411 
0412     @Override
0413     public void write(org.apache.thrift.protocol.TProtocol prot, TTableSchema struct) throws org.apache.thrift.TException {
0414       TTupleProtocol oprot = (TTupleProtocol) prot;
0415       {
0416         oprot.writeI32(struct.columns.size());
0417         for (TColumnDesc _iter42 : struct.columns)
0418         {
0419           _iter42.write(oprot);
0420         }
0421       }
0422     }
0423 
0424     @Override
0425     public void read(org.apache.thrift.protocol.TProtocol prot, TTableSchema struct) throws org.apache.thrift.TException {
0426       TTupleProtocol iprot = (TTupleProtocol) prot;
0427       {
0428         org.apache.thrift.protocol.TList _list43 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
0429         struct.columns = new ArrayList<TColumnDesc>(_list43.size);
0430         TColumnDesc _elem44;
0431         for (int _i45 = 0; _i45 < _list43.size; ++_i45)
0432         {
0433           _elem44 = new TColumnDesc();
0434           _elem44.read(iprot);
0435           struct.columns.add(_elem44);
0436         }
0437       }
0438       struct.setColumnsIsSet(true);
0439     }
0440   }
0441 
0442 }
0443