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