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 TGetFunctionsResp implements org.apache.thrift.TBase<TGetFunctionsResp, TGetFunctionsResp._Fields>, java.io.Serializable, Cloneable, Comparable<TGetFunctionsResp> {
0039 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetFunctionsResp");
0040
0041 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);
0042 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)2);
0043
0044 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0045 static {
0046 schemes.put(StandardScheme.class, new TGetFunctionsRespStandardSchemeFactory());
0047 schemes.put(TupleScheme.class, new TGetFunctionsRespTupleSchemeFactory());
0048 }
0049
0050 private TStatus status;
0051 private TOperationHandle operationHandle;
0052
0053
0054 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0055 STATUS((short)1, "status"),
0056 OPERATION_HANDLE((short)2, "operationHandle");
0057
0058 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0059
0060 static {
0061 for (_Fields field : EnumSet.allOf(_Fields.class)) {
0062 byName.put(field.getFieldName(), field);
0063 }
0064 }
0065
0066
0067
0068
0069 public static _Fields findByThriftId(int fieldId) {
0070 switch(fieldId) {
0071 case 1:
0072 return STATUS;
0073 case 2:
0074 return OPERATION_HANDLE;
0075 default:
0076 return null;
0077 }
0078 }
0079
0080
0081
0082
0083
0084 public static _Fields findByThriftIdOrThrow(int fieldId) {
0085 _Fields fields = findByThriftId(fieldId);
0086 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0087 return fields;
0088 }
0089
0090
0091
0092
0093 public static _Fields findByName(String name) {
0094 return byName.get(name);
0095 }
0096
0097 private final short _thriftId;
0098 private final String _fieldName;
0099
0100 _Fields(short thriftId, String fieldName) {
0101 _thriftId = thriftId;
0102 _fieldName = fieldName;
0103 }
0104
0105 public short getThriftFieldId() {
0106 return _thriftId;
0107 }
0108
0109 public String getFieldName() {
0110 return _fieldName;
0111 }
0112 }
0113
0114
0115 private static final _Fields optionals[] = {_Fields.OPERATION_HANDLE};
0116 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0117 static {
0118 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0119 tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
0120 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStatus.class)));
0121 tmpMap.put(_Fields.OPERATION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("operationHandle", org.apache.thrift.TFieldRequirementType.OPTIONAL,
0122 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TOperationHandle.class)));
0123 metaDataMap = Collections.unmodifiableMap(tmpMap);
0124 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetFunctionsResp.class, metaDataMap);
0125 }
0126
0127 public TGetFunctionsResp() {
0128 }
0129
0130 public TGetFunctionsResp(
0131 TStatus status)
0132 {
0133 this();
0134 this.status = status;
0135 }
0136
0137
0138
0139
0140 public TGetFunctionsResp(TGetFunctionsResp other) {
0141 if (other.isSetStatus()) {
0142 this.status = new TStatus(other.status);
0143 }
0144 if (other.isSetOperationHandle()) {
0145 this.operationHandle = new TOperationHandle(other.operationHandle);
0146 }
0147 }
0148
0149 public TGetFunctionsResp deepCopy() {
0150 return new TGetFunctionsResp(this);
0151 }
0152
0153 @Override
0154 public void clear() {
0155 this.status = null;
0156 this.operationHandle = null;
0157 }
0158
0159 public TStatus getStatus() {
0160 return this.status;
0161 }
0162
0163 public void setStatus(TStatus status) {
0164 this.status = status;
0165 }
0166
0167 public void unsetStatus() {
0168 this.status = null;
0169 }
0170
0171
0172 public boolean isSetStatus() {
0173 return this.status != null;
0174 }
0175
0176 public void setStatusIsSet(boolean value) {
0177 if (!value) {
0178 this.status = null;
0179 }
0180 }
0181
0182 public TOperationHandle getOperationHandle() {
0183 return this.operationHandle;
0184 }
0185
0186 public void setOperationHandle(TOperationHandle operationHandle) {
0187 this.operationHandle = operationHandle;
0188 }
0189
0190 public void unsetOperationHandle() {
0191 this.operationHandle = null;
0192 }
0193
0194
0195 public boolean isSetOperationHandle() {
0196 return this.operationHandle != null;
0197 }
0198
0199 public void setOperationHandleIsSet(boolean value) {
0200 if (!value) {
0201 this.operationHandle = null;
0202 }
0203 }
0204
0205 public void setFieldValue(_Fields field, Object value) {
0206 switch (field) {
0207 case STATUS:
0208 if (value == null) {
0209 unsetStatus();
0210 } else {
0211 setStatus((TStatus)value);
0212 }
0213 break;
0214
0215 case OPERATION_HANDLE:
0216 if (value == null) {
0217 unsetOperationHandle();
0218 } else {
0219 setOperationHandle((TOperationHandle)value);
0220 }
0221 break;
0222
0223 }
0224 }
0225
0226 public Object getFieldValue(_Fields field) {
0227 switch (field) {
0228 case STATUS:
0229 return getStatus();
0230
0231 case OPERATION_HANDLE:
0232 return getOperationHandle();
0233
0234 }
0235 throw new IllegalStateException();
0236 }
0237
0238
0239 public boolean isSet(_Fields field) {
0240 if (field == null) {
0241 throw new IllegalArgumentException();
0242 }
0243
0244 switch (field) {
0245 case STATUS:
0246 return isSetStatus();
0247 case OPERATION_HANDLE:
0248 return isSetOperationHandle();
0249 }
0250 throw new IllegalStateException();
0251 }
0252
0253 @Override
0254 public boolean equals(Object that) {
0255 if (that == null)
0256 return false;
0257 if (that instanceof TGetFunctionsResp)
0258 return this.equals((TGetFunctionsResp)that);
0259 return false;
0260 }
0261
0262 public boolean equals(TGetFunctionsResp that) {
0263 if (that == null)
0264 return false;
0265
0266 boolean this_present_status = true && this.isSetStatus();
0267 boolean that_present_status = true && that.isSetStatus();
0268 if (this_present_status || that_present_status) {
0269 if (!(this_present_status && that_present_status))
0270 return false;
0271 if (!this.status.equals(that.status))
0272 return false;
0273 }
0274
0275 boolean this_present_operationHandle = true && this.isSetOperationHandle();
0276 boolean that_present_operationHandle = true && that.isSetOperationHandle();
0277 if (this_present_operationHandle || that_present_operationHandle) {
0278 if (!(this_present_operationHandle && that_present_operationHandle))
0279 return false;
0280 if (!this.operationHandle.equals(that.operationHandle))
0281 return false;
0282 }
0283
0284 return true;
0285 }
0286
0287 @Override
0288 public int hashCode() {
0289 List<Object> list = new ArrayList<Object>();
0290
0291 boolean present_status = true && (isSetStatus());
0292 list.add(present_status);
0293 if (present_status)
0294 list.add(status);
0295
0296 boolean present_operationHandle = true && (isSetOperationHandle());
0297 list.add(present_operationHandle);
0298 if (present_operationHandle)
0299 list.add(operationHandle);
0300
0301 return list.hashCode();
0302 }
0303
0304 @Override
0305 public int compareTo(TGetFunctionsResp other) {
0306 if (!getClass().equals(other.getClass())) {
0307 return getClass().getName().compareTo(other.getClass().getName());
0308 }
0309
0310 int lastComparison = 0;
0311
0312 lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus());
0313 if (lastComparison != 0) {
0314 return lastComparison;
0315 }
0316 if (isSetStatus()) {
0317 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
0318 if (lastComparison != 0) {
0319 return lastComparison;
0320 }
0321 }
0322 lastComparison = Boolean.valueOf(isSetOperationHandle()).compareTo(other.isSetOperationHandle());
0323 if (lastComparison != 0) {
0324 return lastComparison;
0325 }
0326 if (isSetOperationHandle()) {
0327 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationHandle, other.operationHandle);
0328 if (lastComparison != 0) {
0329 return lastComparison;
0330 }
0331 }
0332 return 0;
0333 }
0334
0335 public _Fields fieldForId(int fieldId) {
0336 return _Fields.findByThriftId(fieldId);
0337 }
0338
0339 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0340 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0341 }
0342
0343 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0344 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0345 }
0346
0347 @Override
0348 public String toString() {
0349 StringBuilder sb = new StringBuilder("TGetFunctionsResp(");
0350 boolean first = true;
0351
0352 sb.append("status:");
0353 if (this.status == null) {
0354 sb.append("null");
0355 } else {
0356 sb.append(this.status);
0357 }
0358 first = false;
0359 if (isSetOperationHandle()) {
0360 if (!first) sb.append(", ");
0361 sb.append("operationHandle:");
0362 if (this.operationHandle == null) {
0363 sb.append("null");
0364 } else {
0365 sb.append(this.operationHandle);
0366 }
0367 first = false;
0368 }
0369 sb.append(")");
0370 return sb.toString();
0371 }
0372
0373 public void validate() throws org.apache.thrift.TException {
0374
0375 if (!isSetStatus()) {
0376 throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
0377 }
0378
0379
0380 if (status != null) {
0381 status.validate();
0382 }
0383 if (operationHandle != null) {
0384 operationHandle.validate();
0385 }
0386 }
0387
0388 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0389 try {
0390 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0391 } catch (org.apache.thrift.TException te) {
0392 throw new java.io.IOException(te);
0393 }
0394 }
0395
0396 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0397 try {
0398 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0399 } catch (org.apache.thrift.TException te) {
0400 throw new java.io.IOException(te);
0401 }
0402 }
0403
0404 private static class TGetFunctionsRespStandardSchemeFactory implements SchemeFactory {
0405 public TGetFunctionsRespStandardScheme getScheme() {
0406 return new TGetFunctionsRespStandardScheme();
0407 }
0408 }
0409
0410 private static class TGetFunctionsRespStandardScheme extends StandardScheme<TGetFunctionsResp> {
0411
0412 public void read(org.apache.thrift.protocol.TProtocol iprot, TGetFunctionsResp struct) throws org.apache.thrift.TException {
0413 org.apache.thrift.protocol.TField schemeField;
0414 iprot.readStructBegin();
0415 while (true)
0416 {
0417 schemeField = iprot.readFieldBegin();
0418 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0419 break;
0420 }
0421 switch (schemeField.id) {
0422 case 1:
0423 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0424 struct.status = new TStatus();
0425 struct.status.read(iprot);
0426 struct.setStatusIsSet(true);
0427 } else {
0428 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0429 }
0430 break;
0431 case 2:
0432 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0433 struct.operationHandle = new TOperationHandle();
0434 struct.operationHandle.read(iprot);
0435 struct.setOperationHandleIsSet(true);
0436 } else {
0437 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0438 }
0439 break;
0440 default:
0441 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0442 }
0443 iprot.readFieldEnd();
0444 }
0445 iprot.readStructEnd();
0446 struct.validate();
0447 }
0448
0449 public void write(org.apache.thrift.protocol.TProtocol oprot, TGetFunctionsResp struct) throws org.apache.thrift.TException {
0450 struct.validate();
0451
0452 oprot.writeStructBegin(STRUCT_DESC);
0453 if (struct.status != null) {
0454 oprot.writeFieldBegin(STATUS_FIELD_DESC);
0455 struct.status.write(oprot);
0456 oprot.writeFieldEnd();
0457 }
0458 if (struct.operationHandle != null) {
0459 if (struct.isSetOperationHandle()) {
0460 oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC);
0461 struct.operationHandle.write(oprot);
0462 oprot.writeFieldEnd();
0463 }
0464 }
0465 oprot.writeFieldStop();
0466 oprot.writeStructEnd();
0467 }
0468
0469 }
0470
0471 private static class TGetFunctionsRespTupleSchemeFactory implements SchemeFactory {
0472 public TGetFunctionsRespTupleScheme getScheme() {
0473 return new TGetFunctionsRespTupleScheme();
0474 }
0475 }
0476
0477 private static class TGetFunctionsRespTupleScheme extends TupleScheme<TGetFunctionsResp> {
0478
0479 @Override
0480 public void write(org.apache.thrift.protocol.TProtocol prot, TGetFunctionsResp struct) throws org.apache.thrift.TException {
0481 TTupleProtocol oprot = (TTupleProtocol) prot;
0482 struct.status.write(oprot);
0483 BitSet optionals = new BitSet();
0484 if (struct.isSetOperationHandle()) {
0485 optionals.set(0);
0486 }
0487 oprot.writeBitSet(optionals, 1);
0488 if (struct.isSetOperationHandle()) {
0489 struct.operationHandle.write(oprot);
0490 }
0491 }
0492
0493 @Override
0494 public void read(org.apache.thrift.protocol.TProtocol prot, TGetFunctionsResp struct) throws org.apache.thrift.TException {
0495 TTupleProtocol iprot = (TTupleProtocol) prot;
0496 struct.status = new TStatus();
0497 struct.status.read(iprot);
0498 struct.setStatusIsSet(true);
0499 BitSet incoming = iprot.readBitSet(1);
0500 if (incoming.get(0)) {
0501 struct.operationHandle = new TOperationHandle();
0502 struct.operationHandle.read(iprot);
0503 struct.setOperationHandleIsSet(true);
0504 }
0505 }
0506 }
0507
0508 }
0509