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 TColumnDesc implements org.apache.thrift.TBase<TColumnDesc, TColumnDesc._Fields>, java.io.Serializable, Cloneable, Comparable<TColumnDesc> {
0039 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TColumnDesc");
0040
0041 private static final org.apache.thrift.protocol.TField COLUMN_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("columnName", org.apache.thrift.protocol.TType.STRING, (short)1);
0042 private static final org.apache.thrift.protocol.TField TYPE_DESC_FIELD_DESC = new org.apache.thrift.protocol.TField("typeDesc", org.apache.thrift.protocol.TType.STRUCT, (short)2);
0043 private static final org.apache.thrift.protocol.TField POSITION_FIELD_DESC = new org.apache.thrift.protocol.TField("position", org.apache.thrift.protocol.TType.I32, (short)3);
0044 private static final org.apache.thrift.protocol.TField COMMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("comment", org.apache.thrift.protocol.TType.STRING, (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 TColumnDescStandardSchemeFactory());
0049 schemes.put(TupleScheme.class, new TColumnDescTupleSchemeFactory());
0050 }
0051
0052 private String columnName;
0053 private TTypeDesc typeDesc;
0054 private int position;
0055 private String comment;
0056
0057
0058 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0059 COLUMN_NAME((short)1, "columnName"),
0060 TYPE_DESC((short)2, "typeDesc"),
0061 POSITION((short)3, "position"),
0062 COMMENT((short)4, "comment");
0063
0064 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0065
0066 static {
0067 for (_Fields field : EnumSet.allOf(_Fields.class)) {
0068 byName.put(field.getFieldName(), field);
0069 }
0070 }
0071
0072
0073
0074
0075 public static _Fields findByThriftId(int fieldId) {
0076 switch(fieldId) {
0077 case 1:
0078 return COLUMN_NAME;
0079 case 2:
0080 return TYPE_DESC;
0081 case 3:
0082 return POSITION;
0083 case 4:
0084 return COMMENT;
0085 default:
0086 return null;
0087 }
0088 }
0089
0090
0091
0092
0093
0094 public static _Fields findByThriftIdOrThrow(int fieldId) {
0095 _Fields fields = findByThriftId(fieldId);
0096 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0097 return fields;
0098 }
0099
0100
0101
0102
0103 public static _Fields findByName(String name) {
0104 return byName.get(name);
0105 }
0106
0107 private final short _thriftId;
0108 private final String _fieldName;
0109
0110 _Fields(short thriftId, String fieldName) {
0111 _thriftId = thriftId;
0112 _fieldName = fieldName;
0113 }
0114
0115 public short getThriftFieldId() {
0116 return _thriftId;
0117 }
0118
0119 public String getFieldName() {
0120 return _fieldName;
0121 }
0122 }
0123
0124
0125 private static final int __POSITION_ISSET_ID = 0;
0126 private byte __isset_bitfield = 0;
0127 private static final _Fields optionals[] = {_Fields.COMMENT};
0128 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0129 static {
0130 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0131 tmpMap.put(_Fields.COLUMN_NAME, new org.apache.thrift.meta_data.FieldMetaData("columnName", org.apache.thrift.TFieldRequirementType.REQUIRED,
0132 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0133 tmpMap.put(_Fields.TYPE_DESC, new org.apache.thrift.meta_data.FieldMetaData("typeDesc", org.apache.thrift.TFieldRequirementType.REQUIRED,
0134 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TTypeDesc.class)));
0135 tmpMap.put(_Fields.POSITION, new org.apache.thrift.meta_data.FieldMetaData("position", org.apache.thrift.TFieldRequirementType.REQUIRED,
0136 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
0137 tmpMap.put(_Fields.COMMENT, new org.apache.thrift.meta_data.FieldMetaData("comment", org.apache.thrift.TFieldRequirementType.OPTIONAL,
0138 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0139 metaDataMap = Collections.unmodifiableMap(tmpMap);
0140 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TColumnDesc.class, metaDataMap);
0141 }
0142
0143 public TColumnDesc() {
0144 }
0145
0146 public TColumnDesc(
0147 String columnName,
0148 TTypeDesc typeDesc,
0149 int position)
0150 {
0151 this();
0152 this.columnName = columnName;
0153 this.typeDesc = typeDesc;
0154 this.position = position;
0155 setPositionIsSet(true);
0156 }
0157
0158
0159
0160
0161 public TColumnDesc(TColumnDesc other) {
0162 __isset_bitfield = other.__isset_bitfield;
0163 if (other.isSetColumnName()) {
0164 this.columnName = other.columnName;
0165 }
0166 if (other.isSetTypeDesc()) {
0167 this.typeDesc = new TTypeDesc(other.typeDesc);
0168 }
0169 this.position = other.position;
0170 if (other.isSetComment()) {
0171 this.comment = other.comment;
0172 }
0173 }
0174
0175 public TColumnDesc deepCopy() {
0176 return new TColumnDesc(this);
0177 }
0178
0179 @Override
0180 public void clear() {
0181 this.columnName = null;
0182 this.typeDesc = null;
0183 setPositionIsSet(false);
0184 this.position = 0;
0185 this.comment = null;
0186 }
0187
0188 public String getColumnName() {
0189 return this.columnName;
0190 }
0191
0192 public void setColumnName(String columnName) {
0193 this.columnName = columnName;
0194 }
0195
0196 public void unsetColumnName() {
0197 this.columnName = null;
0198 }
0199
0200
0201 public boolean isSetColumnName() {
0202 return this.columnName != null;
0203 }
0204
0205 public void setColumnNameIsSet(boolean value) {
0206 if (!value) {
0207 this.columnName = null;
0208 }
0209 }
0210
0211 public TTypeDesc getTypeDesc() {
0212 return this.typeDesc;
0213 }
0214
0215 public void setTypeDesc(TTypeDesc typeDesc) {
0216 this.typeDesc = typeDesc;
0217 }
0218
0219 public void unsetTypeDesc() {
0220 this.typeDesc = null;
0221 }
0222
0223
0224 public boolean isSetTypeDesc() {
0225 return this.typeDesc != null;
0226 }
0227
0228 public void setTypeDescIsSet(boolean value) {
0229 if (!value) {
0230 this.typeDesc = null;
0231 }
0232 }
0233
0234 public int getPosition() {
0235 return this.position;
0236 }
0237
0238 public void setPosition(int position) {
0239 this.position = position;
0240 setPositionIsSet(true);
0241 }
0242
0243 public void unsetPosition() {
0244 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __POSITION_ISSET_ID);
0245 }
0246
0247
0248 public boolean isSetPosition() {
0249 return EncodingUtils.testBit(__isset_bitfield, __POSITION_ISSET_ID);
0250 }
0251
0252 public void setPositionIsSet(boolean value) {
0253 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __POSITION_ISSET_ID, value);
0254 }
0255
0256 public String getComment() {
0257 return this.comment;
0258 }
0259
0260 public void setComment(String comment) {
0261 this.comment = comment;
0262 }
0263
0264 public void unsetComment() {
0265 this.comment = null;
0266 }
0267
0268
0269 public boolean isSetComment() {
0270 return this.comment != null;
0271 }
0272
0273 public void setCommentIsSet(boolean value) {
0274 if (!value) {
0275 this.comment = null;
0276 }
0277 }
0278
0279 public void setFieldValue(_Fields field, Object value) {
0280 switch (field) {
0281 case COLUMN_NAME:
0282 if (value == null) {
0283 unsetColumnName();
0284 } else {
0285 setColumnName((String)value);
0286 }
0287 break;
0288
0289 case TYPE_DESC:
0290 if (value == null) {
0291 unsetTypeDesc();
0292 } else {
0293 setTypeDesc((TTypeDesc)value);
0294 }
0295 break;
0296
0297 case POSITION:
0298 if (value == null) {
0299 unsetPosition();
0300 } else {
0301 setPosition((Integer)value);
0302 }
0303 break;
0304
0305 case COMMENT:
0306 if (value == null) {
0307 unsetComment();
0308 } else {
0309 setComment((String)value);
0310 }
0311 break;
0312
0313 }
0314 }
0315
0316 public Object getFieldValue(_Fields field) {
0317 switch (field) {
0318 case COLUMN_NAME:
0319 return getColumnName();
0320
0321 case TYPE_DESC:
0322 return getTypeDesc();
0323
0324 case POSITION:
0325 return getPosition();
0326
0327 case COMMENT:
0328 return getComment();
0329
0330 }
0331 throw new IllegalStateException();
0332 }
0333
0334
0335 public boolean isSet(_Fields field) {
0336 if (field == null) {
0337 throw new IllegalArgumentException();
0338 }
0339
0340 switch (field) {
0341 case COLUMN_NAME:
0342 return isSetColumnName();
0343 case TYPE_DESC:
0344 return isSetTypeDesc();
0345 case POSITION:
0346 return isSetPosition();
0347 case COMMENT:
0348 return isSetComment();
0349 }
0350 throw new IllegalStateException();
0351 }
0352
0353 @Override
0354 public boolean equals(Object that) {
0355 if (that == null)
0356 return false;
0357 if (that instanceof TColumnDesc)
0358 return this.equals((TColumnDesc)that);
0359 return false;
0360 }
0361
0362 public boolean equals(TColumnDesc that) {
0363 if (that == null)
0364 return false;
0365
0366 boolean this_present_columnName = true && this.isSetColumnName();
0367 boolean that_present_columnName = true && that.isSetColumnName();
0368 if (this_present_columnName || that_present_columnName) {
0369 if (!(this_present_columnName && that_present_columnName))
0370 return false;
0371 if (!this.columnName.equals(that.columnName))
0372 return false;
0373 }
0374
0375 boolean this_present_typeDesc = true && this.isSetTypeDesc();
0376 boolean that_present_typeDesc = true && that.isSetTypeDesc();
0377 if (this_present_typeDesc || that_present_typeDesc) {
0378 if (!(this_present_typeDesc && that_present_typeDesc))
0379 return false;
0380 if (!this.typeDesc.equals(that.typeDesc))
0381 return false;
0382 }
0383
0384 boolean this_present_position = true;
0385 boolean that_present_position = true;
0386 if (this_present_position || that_present_position) {
0387 if (!(this_present_position && that_present_position))
0388 return false;
0389 if (this.position != that.position)
0390 return false;
0391 }
0392
0393 boolean this_present_comment = true && this.isSetComment();
0394 boolean that_present_comment = true && that.isSetComment();
0395 if (this_present_comment || that_present_comment) {
0396 if (!(this_present_comment && that_present_comment))
0397 return false;
0398 if (!this.comment.equals(that.comment))
0399 return false;
0400 }
0401
0402 return true;
0403 }
0404
0405 @Override
0406 public int hashCode() {
0407 List<Object> list = new ArrayList<Object>();
0408
0409 boolean present_columnName = true && (isSetColumnName());
0410 list.add(present_columnName);
0411 if (present_columnName)
0412 list.add(columnName);
0413
0414 boolean present_typeDesc = true && (isSetTypeDesc());
0415 list.add(present_typeDesc);
0416 if (present_typeDesc)
0417 list.add(typeDesc);
0418
0419 boolean present_position = true;
0420 list.add(present_position);
0421 if (present_position)
0422 list.add(position);
0423
0424 boolean present_comment = true && (isSetComment());
0425 list.add(present_comment);
0426 if (present_comment)
0427 list.add(comment);
0428
0429 return list.hashCode();
0430 }
0431
0432 @Override
0433 public int compareTo(TColumnDesc other) {
0434 if (!getClass().equals(other.getClass())) {
0435 return getClass().getName().compareTo(other.getClass().getName());
0436 }
0437
0438 int lastComparison = 0;
0439
0440 lastComparison = Boolean.valueOf(isSetColumnName()).compareTo(other.isSetColumnName());
0441 if (lastComparison != 0) {
0442 return lastComparison;
0443 }
0444 if (isSetColumnName()) {
0445 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columnName, other.columnName);
0446 if (lastComparison != 0) {
0447 return lastComparison;
0448 }
0449 }
0450 lastComparison = Boolean.valueOf(isSetTypeDesc()).compareTo(other.isSetTypeDesc());
0451 if (lastComparison != 0) {
0452 return lastComparison;
0453 }
0454 if (isSetTypeDesc()) {
0455 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.typeDesc, other.typeDesc);
0456 if (lastComparison != 0) {
0457 return lastComparison;
0458 }
0459 }
0460 lastComparison = Boolean.valueOf(isSetPosition()).compareTo(other.isSetPosition());
0461 if (lastComparison != 0) {
0462 return lastComparison;
0463 }
0464 if (isSetPosition()) {
0465 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.position, other.position);
0466 if (lastComparison != 0) {
0467 return lastComparison;
0468 }
0469 }
0470 lastComparison = Boolean.valueOf(isSetComment()).compareTo(other.isSetComment());
0471 if (lastComparison != 0) {
0472 return lastComparison;
0473 }
0474 if (isSetComment()) {
0475 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.comment, other.comment);
0476 if (lastComparison != 0) {
0477 return lastComparison;
0478 }
0479 }
0480 return 0;
0481 }
0482
0483 public _Fields fieldForId(int fieldId) {
0484 return _Fields.findByThriftId(fieldId);
0485 }
0486
0487 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0488 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0489 }
0490
0491 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0492 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0493 }
0494
0495 @Override
0496 public String toString() {
0497 StringBuilder sb = new StringBuilder("TColumnDesc(");
0498 boolean first = true;
0499
0500 sb.append("columnName:");
0501 if (this.columnName == null) {
0502 sb.append("null");
0503 } else {
0504 sb.append(this.columnName);
0505 }
0506 first = false;
0507 if (!first) sb.append(", ");
0508 sb.append("typeDesc:");
0509 if (this.typeDesc == null) {
0510 sb.append("null");
0511 } else {
0512 sb.append(this.typeDesc);
0513 }
0514 first = false;
0515 if (!first) sb.append(", ");
0516 sb.append("position:");
0517 sb.append(this.position);
0518 first = false;
0519 if (isSetComment()) {
0520 if (!first) sb.append(", ");
0521 sb.append("comment:");
0522 if (this.comment == null) {
0523 sb.append("null");
0524 } else {
0525 sb.append(this.comment);
0526 }
0527 first = false;
0528 }
0529 sb.append(")");
0530 return sb.toString();
0531 }
0532
0533 public void validate() throws org.apache.thrift.TException {
0534
0535 if (!isSetColumnName()) {
0536 throw new org.apache.thrift.protocol.TProtocolException("Required field 'columnName' is unset! Struct:" + toString());
0537 }
0538
0539 if (!isSetTypeDesc()) {
0540 throw new org.apache.thrift.protocol.TProtocolException("Required field 'typeDesc' is unset! Struct:" + toString());
0541 }
0542
0543 if (!isSetPosition()) {
0544 throw new org.apache.thrift.protocol.TProtocolException("Required field 'position' is unset! Struct:" + toString());
0545 }
0546
0547
0548 if (typeDesc != null) {
0549 typeDesc.validate();
0550 }
0551 }
0552
0553 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0554 try {
0555 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0556 } catch (org.apache.thrift.TException te) {
0557 throw new java.io.IOException(te);
0558 }
0559 }
0560
0561 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0562 try {
0563
0564 __isset_bitfield = 0;
0565 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0566 } catch (org.apache.thrift.TException te) {
0567 throw new java.io.IOException(te);
0568 }
0569 }
0570
0571 private static class TColumnDescStandardSchemeFactory implements SchemeFactory {
0572 public TColumnDescStandardScheme getScheme() {
0573 return new TColumnDescStandardScheme();
0574 }
0575 }
0576
0577 private static class TColumnDescStandardScheme extends StandardScheme<TColumnDesc> {
0578
0579 public void read(org.apache.thrift.protocol.TProtocol iprot, TColumnDesc struct) throws org.apache.thrift.TException {
0580 org.apache.thrift.protocol.TField schemeField;
0581 iprot.readStructBegin();
0582 while (true)
0583 {
0584 schemeField = iprot.readFieldBegin();
0585 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0586 break;
0587 }
0588 switch (schemeField.id) {
0589 case 1:
0590 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0591 struct.columnName = iprot.readString();
0592 struct.setColumnNameIsSet(true);
0593 } else {
0594 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0595 }
0596 break;
0597 case 2:
0598 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0599 struct.typeDesc = new TTypeDesc();
0600 struct.typeDesc.read(iprot);
0601 struct.setTypeDescIsSet(true);
0602 } else {
0603 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0604 }
0605 break;
0606 case 3:
0607 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
0608 struct.position = iprot.readI32();
0609 struct.setPositionIsSet(true);
0610 } else {
0611 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0612 }
0613 break;
0614 case 4:
0615 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0616 struct.comment = iprot.readString();
0617 struct.setCommentIsSet(true);
0618 } else {
0619 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0620 }
0621 break;
0622 default:
0623 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0624 }
0625 iprot.readFieldEnd();
0626 }
0627 iprot.readStructEnd();
0628 struct.validate();
0629 }
0630
0631 public void write(org.apache.thrift.protocol.TProtocol oprot, TColumnDesc struct) throws org.apache.thrift.TException {
0632 struct.validate();
0633
0634 oprot.writeStructBegin(STRUCT_DESC);
0635 if (struct.columnName != null) {
0636 oprot.writeFieldBegin(COLUMN_NAME_FIELD_DESC);
0637 oprot.writeString(struct.columnName);
0638 oprot.writeFieldEnd();
0639 }
0640 if (struct.typeDesc != null) {
0641 oprot.writeFieldBegin(TYPE_DESC_FIELD_DESC);
0642 struct.typeDesc.write(oprot);
0643 oprot.writeFieldEnd();
0644 }
0645 oprot.writeFieldBegin(POSITION_FIELD_DESC);
0646 oprot.writeI32(struct.position);
0647 oprot.writeFieldEnd();
0648 if (struct.comment != null) {
0649 if (struct.isSetComment()) {
0650 oprot.writeFieldBegin(COMMENT_FIELD_DESC);
0651 oprot.writeString(struct.comment);
0652 oprot.writeFieldEnd();
0653 }
0654 }
0655 oprot.writeFieldStop();
0656 oprot.writeStructEnd();
0657 }
0658
0659 }
0660
0661 private static class TColumnDescTupleSchemeFactory implements SchemeFactory {
0662 public TColumnDescTupleScheme getScheme() {
0663 return new TColumnDescTupleScheme();
0664 }
0665 }
0666
0667 private static class TColumnDescTupleScheme extends TupleScheme<TColumnDesc> {
0668
0669 @Override
0670 public void write(org.apache.thrift.protocol.TProtocol prot, TColumnDesc struct) throws org.apache.thrift.TException {
0671 TTupleProtocol oprot = (TTupleProtocol) prot;
0672 oprot.writeString(struct.columnName);
0673 struct.typeDesc.write(oprot);
0674 oprot.writeI32(struct.position);
0675 BitSet optionals = new BitSet();
0676 if (struct.isSetComment()) {
0677 optionals.set(0);
0678 }
0679 oprot.writeBitSet(optionals, 1);
0680 if (struct.isSetComment()) {
0681 oprot.writeString(struct.comment);
0682 }
0683 }
0684
0685 @Override
0686 public void read(org.apache.thrift.protocol.TProtocol prot, TColumnDesc struct) throws org.apache.thrift.TException {
0687 TTupleProtocol iprot = (TTupleProtocol) prot;
0688 struct.columnName = iprot.readString();
0689 struct.setColumnNameIsSet(true);
0690 struct.typeDesc = new TTypeDesc();
0691 struct.typeDesc.read(iprot);
0692 struct.setTypeDescIsSet(true);
0693 struct.position = iprot.readI32();
0694 struct.setPositionIsSet(true);
0695 BitSet incoming = iprot.readBitSet(1);
0696 if (incoming.get(0)) {
0697 struct.comment = iprot.readString();
0698 struct.setCommentIsSet(true);
0699 }
0700 }
0701 }
0702
0703 }
0704