You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2012/11/08 10:44:29 UTC
svn commit: r1406984 [23/29] - in /hive/trunk:
contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/
contrib/src/java/org/apache/hadoop/hive/contrib/serde2/
contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/
contrib/src/test...
Modified: hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/InnerStruct.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/InnerStruct.java?rev=1406984&r1=1406983&r2=1406984&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/InnerStruct.java (original)
+++ hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/InnerStruct.java Thu Nov 8 09:44:19 2012
@@ -1,10 +1,20 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hive.serde.test;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -25,6 +35,12 @@ public class InnerStruct implements org.
private static final org.apache.thrift.protocol.TField FIELD0_FIELD_DESC = new org.apache.thrift.protocol.TField("field0", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new InnerStructStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new InnerStructTupleSchemeFactory());
+ }
+
private int field0; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -87,8 +103,7 @@ public class InnerStruct implements org.
// isset id assignments
private static final int __FIELD0_ISSET_ID = 0;
- private BitSet __isset_bit_vector = new BitSet(1);
-
+ private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -113,8 +128,7 @@ public class InnerStruct implements org.
* Performs a deep copy on <i>other</i>.
*/
public InnerStruct(InnerStruct other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
this.field0 = other.field0;
}
@@ -138,16 +152,16 @@ public class InnerStruct implements org.
}
public void unsetField0() {
- __isset_bit_vector.clear(__FIELD0_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FIELD0_ISSET_ID);
}
/** Returns true if field field0 is set (has been assigned a value) and false otherwise */
public boolean isSetField0() {
- return __isset_bit_vector.get(__FIELD0_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __FIELD0_ISSET_ID);
}
public void setField0IsSet(boolean value) {
- __isset_bit_vector.set(__FIELD0_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FIELD0_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
@@ -241,41 +255,11 @@ public class InnerStruct implements org.
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // FIELD0
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.field0 = iprot.readI32();
- setField0IsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(FIELD0_FIELD_DESC);
- oprot.writeI32(this.field0);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -292,6 +276,7 @@ public class InnerStruct implements org.
public void validate() throws org.apache.thrift.TException {
// check for required fields
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -305,12 +290,92 @@ public class InnerStruct implements org.
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class InnerStructStandardSchemeFactory implements SchemeFactory {
+ public InnerStructStandardScheme getScheme() {
+ return new InnerStructStandardScheme();
+ }
+ }
+
+ private static class InnerStructStandardScheme extends StandardScheme<InnerStruct> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, InnerStruct struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // FIELD0
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.field0 = iprot.readI32();
+ struct.setField0IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, InnerStruct struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(FIELD0_FIELD_DESC);
+ oprot.writeI32(struct.field0);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class InnerStructTupleSchemeFactory implements SchemeFactory {
+ public InnerStructTupleScheme getScheme() {
+ return new InnerStructTupleScheme();
+ }
+ }
+
+ private static class InnerStructTupleScheme extends TupleScheme<InnerStruct> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, InnerStruct struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetField0()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetField0()) {
+ oprot.writeI32(struct.field0);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, InnerStruct struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.field0 = iprot.readI32();
+ struct.setField0IsSet(true);
+ }
+ }
+ }
+
}
Modified: hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java?rev=1406984&r1=1406983&r2=1406984&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java (original)
+++ hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java Thu Nov 8 09:44:19 2012
@@ -1,10 +1,20 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hive.serde.test;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -27,6 +37,12 @@ public class ThriftTestObj implements or
private static final org.apache.thrift.protocol.TField FIELD2_FIELD_DESC = new org.apache.thrift.protocol.TField("field2", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField FIELD3_FIELD_DESC = new org.apache.thrift.protocol.TField("field3", org.apache.thrift.protocol.TType.LIST, (short)3);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ThriftTestObjStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ThriftTestObjTupleSchemeFactory());
+ }
+
private int field1; // required
private String field2; // required
private List<InnerStruct> field3; // required
@@ -97,8 +113,7 @@ public class ThriftTestObj implements or
// isset id assignments
private static final int __FIELD1_ISSET_ID = 0;
- private BitSet __isset_bit_vector = new BitSet(1);
-
+ private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -132,8 +147,7 @@ public class ThriftTestObj implements or
* Performs a deep copy on <i>other</i>.
*/
public ThriftTestObj(ThriftTestObj other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
this.field1 = other.field1;
if (other.isSetField2()) {
this.field2 = other.field2;
@@ -169,16 +183,16 @@ public class ThriftTestObj implements or
}
public void unsetField1() {
- __isset_bit_vector.clear(__FIELD1_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FIELD1_ISSET_ID);
}
/** Returns true if field field1 is set (has been assigned a value) and false otherwise */
public boolean isSetField1() {
- return __isset_bit_vector.get(__FIELD1_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __FIELD1_ISSET_ID);
}
public void setField1IsSet(boolean value) {
- __isset_bit_vector.set(__FIELD1_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FIELD1_ISSET_ID, value);
}
public String getField2() {
@@ -397,83 +411,11 @@ public class ThriftTestObj implements or
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // FIELD1
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.field1 = iprot.readI32();
- setField1IsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // FIELD2
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.field2 = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // FIELD3
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
- this.field3 = new ArrayList<InnerStruct>(_list0.size);
- for (int _i1 = 0; _i1 < _list0.size; ++_i1)
- {
- InnerStruct _elem2; // required
- _elem2 = new InnerStruct();
- _elem2.read(iprot);
- this.field3.add(_elem2);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(FIELD1_FIELD_DESC);
- oprot.writeI32(this.field1);
- oprot.writeFieldEnd();
- if (this.field2 != null) {
- oprot.writeFieldBegin(FIELD2_FIELD_DESC);
- oprot.writeString(this.field2);
- oprot.writeFieldEnd();
- }
- if (this.field3 != null) {
- oprot.writeFieldBegin(FIELD3_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.field3.size()));
- for (InnerStruct _iter3 : this.field3)
- {
- _iter3.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -506,6 +448,7 @@ public class ThriftTestObj implements or
public void validate() throws org.apache.thrift.TException {
// check for required fields
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -519,12 +462,172 @@ public class ThriftTestObj implements or
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class ThriftTestObjStandardSchemeFactory implements SchemeFactory {
+ public ThriftTestObjStandardScheme getScheme() {
+ return new ThriftTestObjStandardScheme();
+ }
+ }
+
+ private static class ThriftTestObjStandardScheme extends StandardScheme<ThriftTestObj> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftTestObj struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // FIELD1
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.field1 = iprot.readI32();
+ struct.setField1IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // FIELD2
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.field2 = iprot.readString();
+ struct.setField2IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // FIELD3
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+ struct.field3 = new ArrayList<InnerStruct>(_list0.size);
+ for (int _i1 = 0; _i1 < _list0.size; ++_i1)
+ {
+ InnerStruct _elem2; // required
+ _elem2 = new InnerStruct();
+ _elem2.read(iprot);
+ struct.field3.add(_elem2);
+ }
+ iprot.readListEnd();
+ }
+ struct.setField3IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftTestObj struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(FIELD1_FIELD_DESC);
+ oprot.writeI32(struct.field1);
+ oprot.writeFieldEnd();
+ if (struct.field2 != null) {
+ oprot.writeFieldBegin(FIELD2_FIELD_DESC);
+ oprot.writeString(struct.field2);
+ oprot.writeFieldEnd();
+ }
+ if (struct.field3 != null) {
+ oprot.writeFieldBegin(FIELD3_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.field3.size()));
+ for (InnerStruct _iter3 : struct.field3)
+ {
+ _iter3.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ThriftTestObjTupleSchemeFactory implements SchemeFactory {
+ public ThriftTestObjTupleScheme getScheme() {
+ return new ThriftTestObjTupleScheme();
+ }
+ }
+
+ private static class ThriftTestObjTupleScheme extends TupleScheme<ThriftTestObj> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ThriftTestObj struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetField1()) {
+ optionals.set(0);
+ }
+ if (struct.isSetField2()) {
+ optionals.set(1);
+ }
+ if (struct.isSetField3()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetField1()) {
+ oprot.writeI32(struct.field1);
+ }
+ if (struct.isSetField2()) {
+ oprot.writeString(struct.field2);
+ }
+ if (struct.isSetField3()) {
+ {
+ oprot.writeI32(struct.field3.size());
+ for (InnerStruct _iter4 : struct.field3)
+ {
+ _iter4.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ThriftTestObj struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.field1 = iprot.readI32();
+ struct.setField1IsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.field2 = iprot.readString();
+ struct.setField2IsSet(true);
+ }
+ if (incoming.get(2)) {
+ {
+ org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.field3 = new ArrayList<InnerStruct>(_list5.size);
+ for (int _i6 = 0; _i6 < _list5.size; ++_i6)
+ {
+ InnerStruct _elem7; // required
+ _elem7 = new InnerStruct();
+ _elem7.read(iprot);
+ struct.field3.add(_elem7);
+ }
+ }
+ struct.setField3IsSet(true);
+ }
+ }
+ }
+
}
Modified: hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java?rev=1406984&r1=1406983&r2=1406984&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java (original)
+++ hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java Thu Nov 8 09:44:19 2012
@@ -1,10 +1,20 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hive.serde2.thrift.test;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -30,6 +40,12 @@ public class Complex implements org.apac
private static final org.apache.thrift.protocol.TField LINT_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("lintString", org.apache.thrift.protocol.TType.LIST, (short)5);
private static final org.apache.thrift.protocol.TField M_STRING_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("mStringString", org.apache.thrift.protocol.TType.MAP, (short)6);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ComplexStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ComplexTupleSchemeFactory());
+ }
+
private int aint; // required
private String aString; // required
private List<Integer> lint; // required
@@ -112,8 +128,7 @@ public class Complex implements org.apac
// isset id assignments
private static final int __AINT_ISSET_ID = 0;
- private BitSet __isset_bit_vector = new BitSet(1);
-
+ private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -163,8 +178,7 @@ public class Complex implements org.apac
* Performs a deep copy on <i>other</i>.
*/
public Complex(Complex other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
this.aint = other.aint;
if (other.isSetAString()) {
this.aString = other.aString;
@@ -232,16 +246,16 @@ public class Complex implements org.apac
}
public void unsetAint() {
- __isset_bit_vector.clear(__AINT_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AINT_ISSET_ID);
}
/** Returns true if field aint is set (has been assigned a value) and false otherwise */
public boolean isSetAint() {
- return __isset_bit_vector.get(__AINT_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __AINT_ISSET_ID);
}
public void setAintIsSet(boolean value) {
- __isset_bit_vector.set(__AINT_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AINT_ISSET_ID, value);
}
public String getAString() {
@@ -666,173 +680,11 @@ public class Complex implements org.apac
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // AINT
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.aint = iprot.readI32();
- setAintIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // A_STRING
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.aString = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // LINT
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
- this.lint = new ArrayList<Integer>(_list0.size);
- for (int _i1 = 0; _i1 < _list0.size; ++_i1)
- {
- int _elem2; // required
- _elem2 = iprot.readI32();
- this.lint.add(_elem2);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // L_STRING
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
- this.lString = new ArrayList<String>(_list3.size);
- for (int _i4 = 0; _i4 < _list3.size; ++_i4)
- {
- String _elem5; // required
- _elem5 = iprot.readString();
- this.lString.add(_elem5);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 5: // LINT_STRING
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list6 = iprot.readListBegin();
- this.lintString = new ArrayList<IntString>(_list6.size);
- for (int _i7 = 0; _i7 < _list6.size; ++_i7)
- {
- IntString _elem8; // required
- _elem8 = new IntString();
- _elem8.read(iprot);
- this.lintString.add(_elem8);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 6: // M_STRING_STRING
- if (field.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map9 = iprot.readMapBegin();
- this.mStringString = new HashMap<String,String>(2*_map9.size);
- for (int _i10 = 0; _i10 < _map9.size; ++_i10)
- {
- String _key11; // required
- String _val12; // required
- _key11 = iprot.readString();
- _val12 = iprot.readString();
- this.mStringString.put(_key11, _val12);
- }
- iprot.readMapEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(AINT_FIELD_DESC);
- oprot.writeI32(this.aint);
- oprot.writeFieldEnd();
- if (this.aString != null) {
- oprot.writeFieldBegin(A_STRING_FIELD_DESC);
- oprot.writeString(this.aString);
- oprot.writeFieldEnd();
- }
- if (this.lint != null) {
- oprot.writeFieldBegin(LINT_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, this.lint.size()));
- for (int _iter13 : this.lint)
- {
- oprot.writeI32(_iter13);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- if (this.lString != null) {
- oprot.writeFieldBegin(L_STRING_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.lString.size()));
- for (String _iter14 : this.lString)
- {
- oprot.writeString(_iter14);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- if (this.lintString != null) {
- oprot.writeFieldBegin(LINT_STRING_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.lintString.size()));
- for (IntString _iter15 : this.lintString)
- {
- _iter15.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- if (this.mStringString != null) {
- oprot.writeFieldBegin(M_STRING_STRING_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.mStringString.size()));
- for (Map.Entry<String, String> _iter16 : this.mStringString.entrySet())
- {
- oprot.writeString(_iter16.getKey());
- oprot.writeString(_iter16.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -889,6 +741,7 @@ public class Complex implements org.apac
public void validate() throws org.apache.thrift.TException {
// check for required fields
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -902,12 +755,343 @@ public class Complex implements org.apac
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class ComplexStandardSchemeFactory implements SchemeFactory {
+ public ComplexStandardScheme getScheme() {
+ return new ComplexStandardScheme();
+ }
+ }
+
+ private static class ComplexStandardScheme extends StandardScheme<Complex> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // AINT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.aint = iprot.readI32();
+ struct.setAintIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // A_STRING
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.aString = iprot.readString();
+ struct.setAStringIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // LINT
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+ struct.lint = new ArrayList<Integer>(_list0.size);
+ for (int _i1 = 0; _i1 < _list0.size; ++_i1)
+ {
+ int _elem2; // required
+ _elem2 = iprot.readI32();
+ struct.lint.add(_elem2);
+ }
+ iprot.readListEnd();
+ }
+ struct.setLintIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // L_STRING
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
+ struct.lString = new ArrayList<String>(_list3.size);
+ for (int _i4 = 0; _i4 < _list3.size; ++_i4)
+ {
+ String _elem5; // required
+ _elem5 = iprot.readString();
+ struct.lString.add(_elem5);
+ }
+ iprot.readListEnd();
+ }
+ struct.setLStringIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // LINT_STRING
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list6 = iprot.readListBegin();
+ struct.lintString = new ArrayList<IntString>(_list6.size);
+ for (int _i7 = 0; _i7 < _list6.size; ++_i7)
+ {
+ IntString _elem8; // required
+ _elem8 = new IntString();
+ _elem8.read(iprot);
+ struct.lintString.add(_elem8);
+ }
+ iprot.readListEnd();
+ }
+ struct.setLintStringIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // M_STRING_STRING
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map9 = iprot.readMapBegin();
+ struct.mStringString = new HashMap<String,String>(2*_map9.size);
+ for (int _i10 = 0; _i10 < _map9.size; ++_i10)
+ {
+ String _key11; // required
+ String _val12; // required
+ _key11 = iprot.readString();
+ _val12 = iprot.readString();
+ struct.mStringString.put(_key11, _val12);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setMStringStringIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, Complex struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(AINT_FIELD_DESC);
+ oprot.writeI32(struct.aint);
+ oprot.writeFieldEnd();
+ if (struct.aString != null) {
+ oprot.writeFieldBegin(A_STRING_FIELD_DESC);
+ oprot.writeString(struct.aString);
+ oprot.writeFieldEnd();
+ }
+ if (struct.lint != null) {
+ oprot.writeFieldBegin(LINT_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.lint.size()));
+ for (int _iter13 : struct.lint)
+ {
+ oprot.writeI32(_iter13);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.lString != null) {
+ oprot.writeFieldBegin(L_STRING_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.lString.size()));
+ for (String _iter14 : struct.lString)
+ {
+ oprot.writeString(_iter14);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.lintString != null) {
+ oprot.writeFieldBegin(LINT_STRING_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.lintString.size()));
+ for (IntString _iter15 : struct.lintString)
+ {
+ _iter15.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.mStringString != null) {
+ oprot.writeFieldBegin(M_STRING_STRING_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.mStringString.size()));
+ for (Map.Entry<String, String> _iter16 : struct.mStringString.entrySet())
+ {
+ oprot.writeString(_iter16.getKey());
+ oprot.writeString(_iter16.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ComplexTupleSchemeFactory implements SchemeFactory {
+ public ComplexTupleScheme getScheme() {
+ return new ComplexTupleScheme();
+ }
+ }
+
+ private static class ComplexTupleScheme extends TupleScheme<Complex> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, Complex struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetAint()) {
+ optionals.set(0);
+ }
+ if (struct.isSetAString()) {
+ optionals.set(1);
+ }
+ if (struct.isSetLint()) {
+ optionals.set(2);
+ }
+ if (struct.isSetLString()) {
+ optionals.set(3);
+ }
+ if (struct.isSetLintString()) {
+ optionals.set(4);
+ }
+ if (struct.isSetMStringString()) {
+ optionals.set(5);
+ }
+ oprot.writeBitSet(optionals, 6);
+ if (struct.isSetAint()) {
+ oprot.writeI32(struct.aint);
+ }
+ if (struct.isSetAString()) {
+ oprot.writeString(struct.aString);
+ }
+ if (struct.isSetLint()) {
+ {
+ oprot.writeI32(struct.lint.size());
+ for (int _iter17 : struct.lint)
+ {
+ oprot.writeI32(_iter17);
+ }
+ }
+ }
+ if (struct.isSetLString()) {
+ {
+ oprot.writeI32(struct.lString.size());
+ for (String _iter18 : struct.lString)
+ {
+ oprot.writeString(_iter18);
+ }
+ }
+ }
+ if (struct.isSetLintString()) {
+ {
+ oprot.writeI32(struct.lintString.size());
+ for (IntString _iter19 : struct.lintString)
+ {
+ _iter19.write(oprot);
+ }
+ }
+ }
+ if (struct.isSetMStringString()) {
+ {
+ oprot.writeI32(struct.mStringString.size());
+ for (Map.Entry<String, String> _iter20 : struct.mStringString.entrySet())
+ {
+ oprot.writeString(_iter20.getKey());
+ oprot.writeString(_iter20.getValue());
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(6);
+ if (incoming.get(0)) {
+ struct.aint = iprot.readI32();
+ struct.setAintIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.aString = iprot.readString();
+ struct.setAStringIsSet(true);
+ }
+ if (incoming.get(2)) {
+ {
+ org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
+ struct.lint = new ArrayList<Integer>(_list21.size);
+ for (int _i22 = 0; _i22 < _list21.size; ++_i22)
+ {
+ int _elem23; // required
+ _elem23 = iprot.readI32();
+ struct.lint.add(_elem23);
+ }
+ }
+ struct.setLintIsSet(true);
+ }
+ if (incoming.get(3)) {
+ {
+ org.apache.thrift.protocol.TList _list24 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.lString = new ArrayList<String>(_list24.size);
+ for (int _i25 = 0; _i25 < _list24.size; ++_i25)
+ {
+ String _elem26; // required
+ _elem26 = iprot.readString();
+ struct.lString.add(_elem26);
+ }
+ }
+ struct.setLStringIsSet(true);
+ }
+ if (incoming.get(4)) {
+ {
+ org.apache.thrift.protocol.TList _list27 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.lintString = new ArrayList<IntString>(_list27.size);
+ for (int _i28 = 0; _i28 < _list27.size; ++_i28)
+ {
+ IntString _elem29; // required
+ _elem29 = new IntString();
+ _elem29.read(iprot);
+ struct.lintString.add(_elem29);
+ }
+ }
+ struct.setLintStringIsSet(true);
+ }
+ if (incoming.get(5)) {
+ {
+ org.apache.thrift.protocol.TMap _map30 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.mStringString = new HashMap<String,String>(2*_map30.size);
+ for (int _i31 = 0; _i31 < _map30.size; ++_i31)
+ {
+ String _key32; // required
+ String _val33; // required
+ _key32 = iprot.readString();
+ _val33 = iprot.readString();
+ struct.mStringString.put(_key32, _val33);
+ }
+ }
+ struct.setMStringStringIsSet(true);
+ }
+ }
+ }
+
}
Modified: hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/IntString.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/IntString.java?rev=1406984&r1=1406983&r2=1406984&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/IntString.java (original)
+++ hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/IntString.java Thu Nov 8 09:44:19 2012
@@ -1,10 +1,20 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hive.serde2.thrift.test;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -27,6 +37,12 @@ public class IntString implements org.ap
private static final org.apache.thrift.protocol.TField MY_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("myString", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField UNDERSCORE_INT_FIELD_DESC = new org.apache.thrift.protocol.TField("underscore_int", org.apache.thrift.protocol.TType.I32, (short)3);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new IntStringStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new IntStringTupleSchemeFactory());
+ }
+
private int myint; // required
private String myString; // required
private int underscore_int; // required
@@ -98,8 +114,7 @@ public class IntString implements org.ap
// isset id assignments
private static final int __MYINT_ISSET_ID = 0;
private static final int __UNDERSCORE_INT_ISSET_ID = 1;
- private BitSet __isset_bit_vector = new BitSet(2);
-
+ private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -133,8 +148,7 @@ public class IntString implements org.ap
* Performs a deep copy on <i>other</i>.
*/
public IntString(IntString other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
this.myint = other.myint;
if (other.isSetMyString()) {
this.myString = other.myString;
@@ -165,16 +179,16 @@ public class IntString implements org.ap
}
public void unsetMyint() {
- __isset_bit_vector.clear(__MYINT_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MYINT_ISSET_ID);
}
/** Returns true if field myint is set (has been assigned a value) and false otherwise */
public boolean isSetMyint() {
- return __isset_bit_vector.get(__MYINT_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __MYINT_ISSET_ID);
}
public void setMyintIsSet(boolean value) {
- __isset_bit_vector.set(__MYINT_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MYINT_ISSET_ID, value);
}
public String getMyString() {
@@ -210,16 +224,16 @@ public class IntString implements org.ap
}
public void unsetUnderscore_int() {
- __isset_bit_vector.clear(__UNDERSCORE_INT_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UNDERSCORE_INT_ISSET_ID);
}
/** Returns true if field underscore_int is set (has been assigned a value) and false otherwise */
public boolean isSetUnderscore_int() {
- return __isset_bit_vector.get(__UNDERSCORE_INT_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __UNDERSCORE_INT_ISSET_ID);
}
public void setUnderscore_intIsSet(boolean value) {
- __isset_bit_vector.set(__UNDERSCORE_INT_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UNDERSCORE_INT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
@@ -377,64 +391,11 @@ public class IntString implements org.ap
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // MYINT
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.myint = iprot.readI32();
- setMyintIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // MY_STRING
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.myString = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // UNDERSCORE_INT
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.underscore_int = iprot.readI32();
- setUnderscore_intIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(MYINT_FIELD_DESC);
- oprot.writeI32(this.myint);
- oprot.writeFieldEnd();
- if (this.myString != null) {
- oprot.writeFieldBegin(MY_STRING_FIELD_DESC);
- oprot.writeString(this.myString);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(UNDERSCORE_INT_FIELD_DESC);
- oprot.writeI32(this.underscore_int);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -463,6 +424,7 @@ public class IntString implements org.ap
public void validate() throws org.apache.thrift.TException {
// check for required fields
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -476,12 +438,136 @@ public class IntString implements org.ap
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class IntStringStandardSchemeFactory implements SchemeFactory {
+ public IntStringStandardScheme getScheme() {
+ return new IntStringStandardScheme();
+ }
+ }
+
+ private static class IntStringStandardScheme extends StandardScheme<IntString> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, IntString struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // MYINT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.myint = iprot.readI32();
+ struct.setMyintIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // MY_STRING
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.myString = iprot.readString();
+ struct.setMyStringIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // UNDERSCORE_INT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.underscore_int = iprot.readI32();
+ struct.setUnderscore_intIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, IntString struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(MYINT_FIELD_DESC);
+ oprot.writeI32(struct.myint);
+ oprot.writeFieldEnd();
+ if (struct.myString != null) {
+ oprot.writeFieldBegin(MY_STRING_FIELD_DESC);
+ oprot.writeString(struct.myString);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(UNDERSCORE_INT_FIELD_DESC);
+ oprot.writeI32(struct.underscore_int);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class IntStringTupleSchemeFactory implements SchemeFactory {
+ public IntStringTupleScheme getScheme() {
+ return new IntStringTupleScheme();
+ }
+ }
+
+ private static class IntStringTupleScheme extends TupleScheme<IntString> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, IntString struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetMyint()) {
+ optionals.set(0);
+ }
+ if (struct.isSetMyString()) {
+ optionals.set(1);
+ }
+ if (struct.isSetUnderscore_int()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetMyint()) {
+ oprot.writeI32(struct.myint);
+ }
+ if (struct.isSetMyString()) {
+ oprot.writeString(struct.myString);
+ }
+ if (struct.isSetUnderscore_int()) {
+ oprot.writeI32(struct.underscore_int);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, IntString struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.myint = iprot.readI32();
+ struct.setMyintIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.myString = iprot.readString();
+ struct.setMyStringIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.underscore_int = iprot.readI32();
+ struct.setUnderscore_intIsSet(true);
+ }
+ }
+ }
+
}