0001
0002
0003
0004
0005
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 TRow implements org.apache.thrift.TBase<TRow, TRow._Fields>, java.io.Serializable, Cloneable, Comparable<TRow> {
0039 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRow");
0040
0041 private static final org.apache.thrift.protocol.TField COL_VALS_FIELD_DESC = new org.apache.thrift.protocol.TField("colVals", 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 TRowStandardSchemeFactory());
0046 schemes.put(TupleScheme.class, new TRowTupleSchemeFactory());
0047 }
0048
0049 private List<TColumnValue> colVals;
0050
0051
0052 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053 COL_VALS((short)1, "colVals");
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
0065
0066 public static _Fields findByThriftId(int fieldId) {
0067 switch(fieldId) {
0068 case 1:
0069 return COL_VALS;
0070 default:
0071 return null;
0072 }
0073 }
0074
0075
0076
0077
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
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
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.COL_VALS, new org.apache.thrift.meta_data.FieldMetaData("colVals", 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, TColumnValue.class))));
0116 metaDataMap = Collections.unmodifiableMap(tmpMap);
0117 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRow.class, metaDataMap);
0118 }
0119
0120 public TRow() {
0121 }
0122
0123 public TRow(
0124 List<TColumnValue> colVals)
0125 {
0126 this();
0127 this.colVals = colVals;
0128 }
0129
0130
0131
0132
0133 public TRow(TRow other) {
0134 if (other.isSetColVals()) {
0135 List<TColumnValue> __this__colVals = new ArrayList<TColumnValue>(other.colVals.size());
0136 for (TColumnValue other_element : other.colVals) {
0137 __this__colVals.add(new TColumnValue(other_element));
0138 }
0139 this.colVals = __this__colVals;
0140 }
0141 }
0142
0143 public TRow deepCopy() {
0144 return new TRow(this);
0145 }
0146
0147 @Override
0148 public void clear() {
0149 this.colVals = null;
0150 }
0151
0152 public int getColValsSize() {
0153 return (this.colVals == null) ? 0 : this.colVals.size();
0154 }
0155
0156 public java.util.Iterator<TColumnValue> getColValsIterator() {
0157 return (this.colVals == null) ? null : this.colVals.iterator();
0158 }
0159
0160 public void addToColVals(TColumnValue elem) {
0161 if (this.colVals == null) {
0162 this.colVals = new ArrayList<TColumnValue>();
0163 }
0164 this.colVals.add(elem);
0165 }
0166
0167 public List<TColumnValue> getColVals() {
0168 return this.colVals;
0169 }
0170
0171 public void setColVals(List<TColumnValue> colVals) {
0172 this.colVals = colVals;
0173 }
0174
0175 public void unsetColVals() {
0176 this.colVals = null;
0177 }
0178
0179
0180 public boolean isSetColVals() {
0181 return this.colVals != null;
0182 }
0183
0184 public void setColValsIsSet(boolean value) {
0185 if (!value) {
0186 this.colVals = null;
0187 }
0188 }
0189
0190 public void setFieldValue(_Fields field, Object value) {
0191 switch (field) {
0192 case COL_VALS:
0193 if (value == null) {
0194 unsetColVals();
0195 } else {
0196 setColVals((List<TColumnValue>)value);
0197 }
0198 break;
0199
0200 }
0201 }
0202
0203 public Object getFieldValue(_Fields field) {
0204 switch (field) {
0205 case COL_VALS:
0206 return getColVals();
0207
0208 }
0209 throw new IllegalStateException();
0210 }
0211
0212
0213 public boolean isSet(_Fields field) {
0214 if (field == null) {
0215 throw new IllegalArgumentException();
0216 }
0217
0218 switch (field) {
0219 case COL_VALS:
0220 return isSetColVals();
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 TRow)
0230 return this.equals((TRow)that);
0231 return false;
0232 }
0233
0234 public boolean equals(TRow that) {
0235 if (that == null)
0236 return false;
0237
0238 boolean this_present_colVals = true && this.isSetColVals();
0239 boolean that_present_colVals = true && that.isSetColVals();
0240 if (this_present_colVals || that_present_colVals) {
0241 if (!(this_present_colVals && that_present_colVals))
0242 return false;
0243 if (!this.colVals.equals(that.colVals))
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_colVals = true && (isSetColVals());
0255 list.add(present_colVals);
0256 if (present_colVals)
0257 list.add(colVals);
0258
0259 return list.hashCode();
0260 }
0261
0262 @Override
0263 public int compareTo(TRow 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(isSetColVals()).compareTo(other.isSetColVals());
0271 if (lastComparison != 0) {
0272 return lastComparison;
0273 }
0274 if (isSetColVals()) {
0275 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.colVals, other.colVals);
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("TRow(");
0298 boolean first = true;
0299
0300 sb.append("colVals:");
0301 if (this.colVals == null) {
0302 sb.append("null");
0303 } else {
0304 sb.append(this.colVals);
0305 }
0306 first = false;
0307 sb.append(")");
0308 return sb.toString();
0309 }
0310
0311 public void validate() throws org.apache.thrift.TException {
0312
0313 if (!isSetColVals()) {
0314 throw new org.apache.thrift.protocol.TProtocolException("Required field 'colVals' is unset! Struct:" + toString());
0315 }
0316
0317
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 TRowStandardSchemeFactory implements SchemeFactory {
0337 public TRowStandardScheme getScheme() {
0338 return new TRowStandardScheme();
0339 }
0340 }
0341
0342 private static class TRowStandardScheme extends StandardScheme<TRow> {
0343
0344 public void read(org.apache.thrift.protocol.TProtocol iprot, TRow 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:
0355 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
0356 {
0357 org.apache.thrift.protocol.TList _list46 = iprot.readListBegin();
0358 struct.colVals = new ArrayList<TColumnValue>(_list46.size);
0359 TColumnValue _elem47;
0360 for (int _i48 = 0; _i48 < _list46.size; ++_i48)
0361 {
0362 _elem47 = new TColumnValue();
0363 _elem47.read(iprot);
0364 struct.colVals.add(_elem47);
0365 }
0366 iprot.readListEnd();
0367 }
0368 struct.setColValsIsSet(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, TRow struct) throws org.apache.thrift.TException {
0383 struct.validate();
0384
0385 oprot.writeStructBegin(STRUCT_DESC);
0386 if (struct.colVals != null) {
0387 oprot.writeFieldBegin(COL_VALS_FIELD_DESC);
0388 {
0389 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.colVals.size()));
0390 for (TColumnValue _iter49 : struct.colVals)
0391 {
0392 _iter49.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 TRowTupleSchemeFactory implements SchemeFactory {
0405 public TRowTupleScheme getScheme() {
0406 return new TRowTupleScheme();
0407 }
0408 }
0409
0410 private static class TRowTupleScheme extends TupleScheme<TRow> {
0411
0412 @Override
0413 public void write(org.apache.thrift.protocol.TProtocol prot, TRow struct) throws org.apache.thrift.TException {
0414 TTupleProtocol oprot = (TTupleProtocol) prot;
0415 {
0416 oprot.writeI32(struct.colVals.size());
0417 for (TColumnValue _iter50 : struct.colVals)
0418 {
0419 _iter50.write(oprot);
0420 }
0421 }
0422 }
0423
0424 @Override
0425 public void read(org.apache.thrift.protocol.TProtocol prot, TRow struct) throws org.apache.thrift.TException {
0426 TTupleProtocol iprot = (TTupleProtocol) prot;
0427 {
0428 org.apache.thrift.protocol.TList _list51 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
0429 struct.colVals = new ArrayList<TColumnValue>(_list51.size);
0430 TColumnValue _elem52;
0431 for (int _i53 = 0; _i53 < _list51.size; ++_i53)
0432 {
0433 _elem52 = new TColumnValue();
0434 _elem52.read(iprot);
0435 struct.colVals.add(_elem52);
0436 }
0437 }
0438 struct.setColValsIsSet(true);
0439 }
0440 }
0441
0442 }
0443