hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amareshw...@apache.org
Subject svn commit: r1625000 [3/3] - in /hive/trunk: contrib/src/test/results/clientpositive/ ql/src/test/queries/clientpositive/ ql/src/test/results/clientnegative/ ql/src/test/results/clientpositive/ ql/src/test/results/compiler/plan/ serde/if/test/ serde/sr...
Date Mon, 15 Sep 2014 11:35:03 GMT
Added: hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/PropValueUnion.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/PropValueUnion.java?rev=1625000&view=auto
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/PropValueUnion.java (added)
+++ hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/PropValueUnion.java Mon Sep 15 11:35:02 2014
@@ -0,0 +1,730 @@
+/**
+ * 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.commons.lang.builder.HashCodeBuilder;
+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;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PropValueUnion extends org.apache.thrift.TUnion<PropValueUnion, PropValueUnion._Fields> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PropValueUnion");
+  private static final org.apache.thrift.protocol.TField INT_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("intValue", org.apache.thrift.protocol.TType.I32, (short)1);
+  private static final org.apache.thrift.protocol.TField LONG_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("longValue", org.apache.thrift.protocol.TType.I64, (short)2);
+  private static final org.apache.thrift.protocol.TField STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("stringValue", org.apache.thrift.protocol.TType.STRING, (short)3);
+  private static final org.apache.thrift.protocol.TField DOUBLE_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("doubleValue", org.apache.thrift.protocol.TType.DOUBLE, (short)4);
+  private static final org.apache.thrift.protocol.TField FLAG_FIELD_DESC = new org.apache.thrift.protocol.TField("flag", org.apache.thrift.protocol.TType.BOOL, (short)5);
+  private static final org.apache.thrift.protocol.TField L_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("lString", org.apache.thrift.protocol.TType.LIST, (short)6);
+  private static final org.apache.thrift.protocol.TField UNION_MSTRING_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("unionMStringString", org.apache.thrift.protocol.TType.MAP, (short)7);
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    INT_VALUE((short)1, "intValue"),
+    LONG_VALUE((short)2, "longValue"),
+    STRING_VALUE((short)3, "stringValue"),
+    DOUBLE_VALUE((short)4, "doubleValue"),
+    FLAG((short)5, "flag"),
+    L_STRING((short)6, "lString"),
+    UNION_MSTRING_STRING((short)7, "unionMStringString");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // INT_VALUE
+          return INT_VALUE;
+        case 2: // LONG_VALUE
+          return LONG_VALUE;
+        case 3: // STRING_VALUE
+          return STRING_VALUE;
+        case 4: // DOUBLE_VALUE
+          return DOUBLE_VALUE;
+        case 5: // FLAG
+          return FLAG;
+        case 6: // L_STRING
+          return L_STRING;
+        case 7: // UNION_MSTRING_STRING
+          return UNION_MSTRING_STRING;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  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);
+    tmpMap.put(_Fields.INT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("intValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.LONG_VALUE, new org.apache.thrift.meta_data.FieldMetaData("longValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("stringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.DOUBLE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("doubleValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
+    tmpMap.put(_Fields.FLAG, new org.apache.thrift.meta_data.FieldMetaData("flag", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.L_STRING, new org.apache.thrift.meta_data.FieldMetaData("lString", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+    tmpMap.put(_Fields.UNION_MSTRING_STRING, new org.apache.thrift.meta_data.FieldMetaData("unionMStringString", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PropValueUnion.class, metaDataMap);
+  }
+
+  public PropValueUnion() {
+    super();
+  }
+
+  public PropValueUnion(_Fields setField, Object value) {
+    super(setField, value);
+  }
+
+  public PropValueUnion(PropValueUnion other) {
+    super(other);
+  }
+  public PropValueUnion deepCopy() {
+    return new PropValueUnion(this);
+  }
+
+  public static PropValueUnion intValue(int value) {
+    PropValueUnion x = new PropValueUnion();
+    x.setIntValue(value);
+    return x;
+  }
+
+  public static PropValueUnion longValue(long value) {
+    PropValueUnion x = new PropValueUnion();
+    x.setLongValue(value);
+    return x;
+  }
+
+  public static PropValueUnion stringValue(String value) {
+    PropValueUnion x = new PropValueUnion();
+    x.setStringValue(value);
+    return x;
+  }
+
+  public static PropValueUnion doubleValue(double value) {
+    PropValueUnion x = new PropValueUnion();
+    x.setDoubleValue(value);
+    return x;
+  }
+
+  public static PropValueUnion flag(boolean value) {
+    PropValueUnion x = new PropValueUnion();
+    x.setFlag(value);
+    return x;
+  }
+
+  public static PropValueUnion lString(List<String> value) {
+    PropValueUnion x = new PropValueUnion();
+    x.setLString(value);
+    return x;
+  }
+
+  public static PropValueUnion unionMStringString(Map<String,String> value) {
+    PropValueUnion x = new PropValueUnion();
+    x.setUnionMStringString(value);
+    return x;
+  }
+
+
+  @Override
+  protected void checkType(_Fields setField, Object value) throws ClassCastException {
+    switch (setField) {
+      case INT_VALUE:
+        if (value instanceof Integer) {
+          break;
+        }
+        throw new ClassCastException("Was expecting value of type Integer for field 'intValue', but got " + value.getClass().getSimpleName());
+      case LONG_VALUE:
+        if (value instanceof Long) {
+          break;
+        }
+        throw new ClassCastException("Was expecting value of type Long for field 'longValue', but got " + value.getClass().getSimpleName());
+      case STRING_VALUE:
+        if (value instanceof String) {
+          break;
+        }
+        throw new ClassCastException("Was expecting value of type String for field 'stringValue', but got " + value.getClass().getSimpleName());
+      case DOUBLE_VALUE:
+        if (value instanceof Double) {
+          break;
+        }
+        throw new ClassCastException("Was expecting value of type Double for field 'doubleValue', but got " + value.getClass().getSimpleName());
+      case FLAG:
+        if (value instanceof Boolean) {
+          break;
+        }
+        throw new ClassCastException("Was expecting value of type Boolean for field 'flag', but got " + value.getClass().getSimpleName());
+      case L_STRING:
+        if (value instanceof List) {
+          break;
+        }
+        throw new ClassCastException("Was expecting value of type List<String> for field 'lString', but got " + value.getClass().getSimpleName());
+      case UNION_MSTRING_STRING:
+        if (value instanceof Map) {
+          break;
+        }
+        throw new ClassCastException("Was expecting value of type Map<String,String> for field 'unionMStringString', but got " + value.getClass().getSimpleName());
+      default:
+        throw new IllegalArgumentException("Unknown field id " + setField);
+    }
+  }
+
+  @Override
+  protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
+    _Fields setField = _Fields.findByThriftId(field.id);
+    if (setField != null) {
+      switch (setField) {
+        case INT_VALUE:
+          if (field.type == INT_VALUE_FIELD_DESC.type) {
+            Integer intValue;
+            intValue = iprot.readI32();
+            return intValue;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
+        case LONG_VALUE:
+          if (field.type == LONG_VALUE_FIELD_DESC.type) {
+            Long longValue;
+            longValue = iprot.readI64();
+            return longValue;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
+        case STRING_VALUE:
+          if (field.type == STRING_VALUE_FIELD_DESC.type) {
+            String stringValue;
+            stringValue = iprot.readString();
+            return stringValue;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
+        case DOUBLE_VALUE:
+          if (field.type == DOUBLE_VALUE_FIELD_DESC.type) {
+            Double doubleValue;
+            doubleValue = iprot.readDouble();
+            return doubleValue;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
+        case FLAG:
+          if (field.type == FLAG_FIELD_DESC.type) {
+            Boolean flag;
+            flag = iprot.readBool();
+            return flag;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
+        case L_STRING:
+          if (field.type == L_STRING_FIELD_DESC.type) {
+            List<String> lString;
+            {
+              org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+              lString = new ArrayList<String>(_list0.size);
+              for (int _i1 = 0; _i1 < _list0.size; ++_i1)
+              {
+                String _elem2; // required
+                _elem2 = iprot.readString();
+                lString.add(_elem2);
+              }
+              iprot.readListEnd();
+            }
+            return lString;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
+        case UNION_MSTRING_STRING:
+          if (field.type == UNION_MSTRING_STRING_FIELD_DESC.type) {
+            Map<String,String> unionMStringString;
+            {
+              org.apache.thrift.protocol.TMap _map3 = iprot.readMapBegin();
+              unionMStringString = new HashMap<String,String>(2*_map3.size);
+              for (int _i4 = 0; _i4 < _map3.size; ++_i4)
+              {
+                String _key5; // required
+                String _val6; // optional
+                _key5 = iprot.readString();
+                _val6 = iprot.readString();
+                unionMStringString.put(_key5, _val6);
+              }
+              iprot.readMapEnd();
+            }
+            return unionMStringString;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
+        default:
+          throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
+      }
+    } else {
+      return null;
+    }
+  }
+
+  @Override
+  protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    switch (setField_) {
+      case INT_VALUE:
+        Integer intValue = (Integer)value_;
+        oprot.writeI32(intValue);
+        return;
+      case LONG_VALUE:
+        Long longValue = (Long)value_;
+        oprot.writeI64(longValue);
+        return;
+      case STRING_VALUE:
+        String stringValue = (String)value_;
+        oprot.writeString(stringValue);
+        return;
+      case DOUBLE_VALUE:
+        Double doubleValue = (Double)value_;
+        oprot.writeDouble(doubleValue);
+        return;
+      case FLAG:
+        Boolean flag = (Boolean)value_;
+        oprot.writeBool(flag);
+        return;
+      case L_STRING:
+        List<String> lString = (List<String>)value_;
+        {
+          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, lString.size()));
+          for (String _iter7 : lString)
+          {
+            oprot.writeString(_iter7);
+          }
+          oprot.writeListEnd();
+        }
+        return;
+      case UNION_MSTRING_STRING:
+        Map<String,String> unionMStringString = (Map<String,String>)value_;
+        {
+          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, unionMStringString.size()));
+          for (Map.Entry<String, String> _iter8 : unionMStringString.entrySet())
+          {
+            oprot.writeString(_iter8.getKey());
+            oprot.writeString(_iter8.getValue());
+          }
+          oprot.writeMapEnd();
+        }
+        return;
+      default:
+        throw new IllegalStateException("Cannot write union with unknown field " + setField_);
+    }
+  }
+
+  @Override
+  protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
+    _Fields setField = _Fields.findByThriftId(fieldID);
+    if (setField != null) {
+      switch (setField) {
+        case INT_VALUE:
+          Integer intValue;
+          intValue = iprot.readI32();
+          return intValue;
+        case LONG_VALUE:
+          Long longValue;
+          longValue = iprot.readI64();
+          return longValue;
+        case STRING_VALUE:
+          String stringValue;
+          stringValue = iprot.readString();
+          return stringValue;
+        case DOUBLE_VALUE:
+          Double doubleValue;
+          doubleValue = iprot.readDouble();
+          return doubleValue;
+        case FLAG:
+          Boolean flag;
+          flag = iprot.readBool();
+          return flag;
+        case L_STRING:
+          List<String> lString;
+          {
+            org.apache.thrift.protocol.TList _list9 = iprot.readListBegin();
+            lString = new ArrayList<String>(_list9.size);
+            for (int _i10 = 0; _i10 < _list9.size; ++_i10)
+            {
+              String _elem11; // required
+              _elem11 = iprot.readString();
+              lString.add(_elem11);
+            }
+            iprot.readListEnd();
+          }
+          return lString;
+        case UNION_MSTRING_STRING:
+          Map<String,String> unionMStringString;
+          {
+            org.apache.thrift.protocol.TMap _map12 = iprot.readMapBegin();
+            unionMStringString = new HashMap<String,String>(2*_map12.size);
+            for (int _i13 = 0; _i13 < _map12.size; ++_i13)
+            {
+              String _key14; // required
+              String _val15; // optional
+              _key14 = iprot.readString();
+              _val15 = iprot.readString();
+              unionMStringString.put(_key14, _val15);
+            }
+            iprot.readMapEnd();
+          }
+          return unionMStringString;
+        default:
+          throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
+      }
+    } else {
+      throw new TProtocolException("Couldn't find a field with field id " + fieldID);
+    }
+  }
+
+  @Override
+  protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    switch (setField_) {
+      case INT_VALUE:
+        Integer intValue = (Integer)value_;
+        oprot.writeI32(intValue);
+        return;
+      case LONG_VALUE:
+        Long longValue = (Long)value_;
+        oprot.writeI64(longValue);
+        return;
+      case STRING_VALUE:
+        String stringValue = (String)value_;
+        oprot.writeString(stringValue);
+        return;
+      case DOUBLE_VALUE:
+        Double doubleValue = (Double)value_;
+        oprot.writeDouble(doubleValue);
+        return;
+      case FLAG:
+        Boolean flag = (Boolean)value_;
+        oprot.writeBool(flag);
+        return;
+      case L_STRING:
+        List<String> lString = (List<String>)value_;
+        {
+          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, lString.size()));
+          for (String _iter16 : lString)
+          {
+            oprot.writeString(_iter16);
+          }
+          oprot.writeListEnd();
+        }
+        return;
+      case UNION_MSTRING_STRING:
+        Map<String,String> unionMStringString = (Map<String,String>)value_;
+        {
+          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, unionMStringString.size()));
+          for (Map.Entry<String, String> _iter17 : unionMStringString.entrySet())
+          {
+            oprot.writeString(_iter17.getKey());
+            oprot.writeString(_iter17.getValue());
+          }
+          oprot.writeMapEnd();
+        }
+        return;
+      default:
+        throw new IllegalStateException("Cannot write union with unknown field " + setField_);
+    }
+  }
+
+  @Override
+  protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
+    switch (setField) {
+      case INT_VALUE:
+        return INT_VALUE_FIELD_DESC;
+      case LONG_VALUE:
+        return LONG_VALUE_FIELD_DESC;
+      case STRING_VALUE:
+        return STRING_VALUE_FIELD_DESC;
+      case DOUBLE_VALUE:
+        return DOUBLE_VALUE_FIELD_DESC;
+      case FLAG:
+        return FLAG_FIELD_DESC;
+      case L_STRING:
+        return L_STRING_FIELD_DESC;
+      case UNION_MSTRING_STRING:
+        return UNION_MSTRING_STRING_FIELD_DESC;
+      default:
+        throw new IllegalArgumentException("Unknown field id " + setField);
+    }
+  }
+
+  @Override
+  protected org.apache.thrift.protocol.TStruct getStructDesc() {
+    return STRUCT_DESC;
+  }
+
+  @Override
+  protected _Fields enumForId(short id) {
+    return _Fields.findByThriftIdOrThrow(id);
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+
+  public int getIntValue() {
+    if (getSetField() == _Fields.INT_VALUE) {
+      return (Integer)getFieldValue();
+    } else {
+      throw new RuntimeException("Cannot get field 'intValue' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setIntValue(int value) {
+    setField_ = _Fields.INT_VALUE;
+    value_ = value;
+  }
+
+  public long getLongValue() {
+    if (getSetField() == _Fields.LONG_VALUE) {
+      return (Long)getFieldValue();
+    } else {
+      throw new RuntimeException("Cannot get field 'longValue' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setLongValue(long value) {
+    setField_ = _Fields.LONG_VALUE;
+    value_ = value;
+  }
+
+  public String getStringValue() {
+    if (getSetField() == _Fields.STRING_VALUE) {
+      return (String)getFieldValue();
+    } else {
+      throw new RuntimeException("Cannot get field 'stringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setStringValue(String value) {
+    if (value == null) throw new NullPointerException();
+    setField_ = _Fields.STRING_VALUE;
+    value_ = value;
+  }
+
+  public double getDoubleValue() {
+    if (getSetField() == _Fields.DOUBLE_VALUE) {
+      return (Double)getFieldValue();
+    } else {
+      throw new RuntimeException("Cannot get field 'doubleValue' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setDoubleValue(double value) {
+    setField_ = _Fields.DOUBLE_VALUE;
+    value_ = value;
+  }
+
+  public boolean getFlag() {
+    if (getSetField() == _Fields.FLAG) {
+      return (Boolean)getFieldValue();
+    } else {
+      throw new RuntimeException("Cannot get field 'flag' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setFlag(boolean value) {
+    setField_ = _Fields.FLAG;
+    value_ = value;
+  }
+
+  public List<String> getLString() {
+    if (getSetField() == _Fields.L_STRING) {
+      return (List<String>)getFieldValue();
+    } else {
+      throw new RuntimeException("Cannot get field 'lString' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setLString(List<String> value) {
+    if (value == null) throw new NullPointerException();
+    setField_ = _Fields.L_STRING;
+    value_ = value;
+  }
+
+  public Map<String,String> getUnionMStringString() {
+    if (getSetField() == _Fields.UNION_MSTRING_STRING) {
+      return (Map<String,String>)getFieldValue();
+    } else {
+      throw new RuntimeException("Cannot get field 'unionMStringString' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setUnionMStringString(Map<String,String> value) {
+    if (value == null) throw new NullPointerException();
+    setField_ = _Fields.UNION_MSTRING_STRING;
+    value_ = value;
+  }
+
+  public boolean isSetIntValue() {
+    return setField_ == _Fields.INT_VALUE;
+  }
+
+
+  public boolean isSetLongValue() {
+    return setField_ == _Fields.LONG_VALUE;
+  }
+
+
+  public boolean isSetStringValue() {
+    return setField_ == _Fields.STRING_VALUE;
+  }
+
+
+  public boolean isSetDoubleValue() {
+    return setField_ == _Fields.DOUBLE_VALUE;
+  }
+
+
+  public boolean isSetFlag() {
+    return setField_ == _Fields.FLAG;
+  }
+
+
+  public boolean isSetLString() {
+    return setField_ == _Fields.L_STRING;
+  }
+
+
+  public boolean isSetUnionMStringString() {
+    return setField_ == _Fields.UNION_MSTRING_STRING;
+  }
+
+
+  public boolean equals(Object other) {
+    if (other instanceof PropValueUnion) {
+      return equals((PropValueUnion)other);
+    } else {
+      return false;
+    }
+  }
+
+  public boolean equals(PropValueUnion other) {
+    return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
+  }
+
+  @Override
+  public int compareTo(PropValueUnion other) {
+    int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
+    if (lastComparison == 0) {
+      return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
+    }
+    return lastComparison;
+  }
+
+
+  @Override
+  public int hashCode() {
+    HashCodeBuilder hcb = new HashCodeBuilder();
+    hcb.append(this.getClass().getName());
+    org.apache.thrift.TFieldIdEnum setField = getSetField();
+    if (setField != null) {
+      hcb.append(setField.getThriftFieldId());
+      Object value = getFieldValue();
+      if (value instanceof org.apache.thrift.TEnum) {
+        hcb.append(((org.apache.thrift.TEnum)getFieldValue()).getValue());
+      } else {
+        hcb.append(value);
+      }
+    }
+    return hcb.toHashCode();
+  }
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      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);
+    }
+  }
+
+
+}

Modified: hive/trunk/serde/src/gen/thrift/gen-py/complex/ttypes.py
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-py/complex/ttypes.py?rev=1625000&r1=1624999&r2=1625000&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-py/complex/ttypes.py (original)
+++ hive/trunk/serde/src/gen/thrift/gen-py/complex/ttypes.py Mon Sep 15 11:35:02 2014
@@ -17,6 +17,156 @@ except:
 
 
 
+class PropValueUnion:
+  """
+  Attributes:
+   - intValue
+   - longValue
+   - stringValue
+   - doubleValue
+   - flag
+   - lString
+   - unionMStringString
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.I32, 'intValue', None, None, ), # 1
+    (2, TType.I64, 'longValue', None, None, ), # 2
+    (3, TType.STRING, 'stringValue', None, None, ), # 3
+    (4, TType.DOUBLE, 'doubleValue', None, None, ), # 4
+    (5, TType.BOOL, 'flag', None, None, ), # 5
+    (6, TType.LIST, 'lString', (TType.STRING,None), None, ), # 6
+    (7, TType.MAP, 'unionMStringString', (TType.STRING,None,TType.STRING,None), None, ), # 7
+  )
+
+  def __init__(self, intValue=None, longValue=None, stringValue=None, doubleValue=None, flag=None, lString=None, unionMStringString=None,):
+    self.intValue = intValue
+    self.longValue = longValue
+    self.stringValue = stringValue
+    self.doubleValue = doubleValue
+    self.flag = flag
+    self.lString = lString
+    self.unionMStringString = unionMStringString
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.I32:
+          self.intValue = iprot.readI32();
+        else:
+          iprot.skip(ftype)
+      elif fid == 2:
+        if ftype == TType.I64:
+          self.longValue = iprot.readI64();
+        else:
+          iprot.skip(ftype)
+      elif fid == 3:
+        if ftype == TType.STRING:
+          self.stringValue = iprot.readString();
+        else:
+          iprot.skip(ftype)
+      elif fid == 4:
+        if ftype == TType.DOUBLE:
+          self.doubleValue = iprot.readDouble();
+        else:
+          iprot.skip(ftype)
+      elif fid == 5:
+        if ftype == TType.BOOL:
+          self.flag = iprot.readBool();
+        else:
+          iprot.skip(ftype)
+      elif fid == 6:
+        if ftype == TType.LIST:
+          self.lString = []
+          (_etype3, _size0) = iprot.readListBegin()
+          for _i4 in xrange(_size0):
+            _elem5 = iprot.readString();
+            self.lString.append(_elem5)
+          iprot.readListEnd()
+        else:
+          iprot.skip(ftype)
+      elif fid == 7:
+        if ftype == TType.MAP:
+          self.unionMStringString = {}
+          (_ktype7, _vtype8, _size6 ) = iprot.readMapBegin() 
+          for _i10 in xrange(_size6):
+            _key11 = iprot.readString();
+            _val12 = iprot.readString();
+            self.unionMStringString[_key11] = _val12
+          iprot.readMapEnd()
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('PropValueUnion')
+    if self.intValue is not None:
+      oprot.writeFieldBegin('intValue', TType.I32, 1)
+      oprot.writeI32(self.intValue)
+      oprot.writeFieldEnd()
+    if self.longValue is not None:
+      oprot.writeFieldBegin('longValue', TType.I64, 2)
+      oprot.writeI64(self.longValue)
+      oprot.writeFieldEnd()
+    if self.stringValue is not None:
+      oprot.writeFieldBegin('stringValue', TType.STRING, 3)
+      oprot.writeString(self.stringValue)
+      oprot.writeFieldEnd()
+    if self.doubleValue is not None:
+      oprot.writeFieldBegin('doubleValue', TType.DOUBLE, 4)
+      oprot.writeDouble(self.doubleValue)
+      oprot.writeFieldEnd()
+    if self.flag is not None:
+      oprot.writeFieldBegin('flag', TType.BOOL, 5)
+      oprot.writeBool(self.flag)
+      oprot.writeFieldEnd()
+    if self.lString is not None:
+      oprot.writeFieldBegin('lString', TType.LIST, 6)
+      oprot.writeListBegin(TType.STRING, len(self.lString))
+      for iter13 in self.lString:
+        oprot.writeString(iter13)
+      oprot.writeListEnd()
+      oprot.writeFieldEnd()
+    if self.unionMStringString is not None:
+      oprot.writeFieldBegin('unionMStringString', TType.MAP, 7)
+      oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.unionMStringString))
+      for kiter14,viter15 in self.unionMStringString.items():
+        oprot.writeString(kiter14)
+        oprot.writeString(viter15)
+      oprot.writeMapEnd()
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
 class IntString:
   """
   Attributes:
@@ -110,6 +260,10 @@ class Complex:
    - lString
    - lintString
    - mStringString
+   - attributes
+   - unionField1
+   - unionField2
+   - unionField3
   """
 
   thrift_spec = (
@@ -120,15 +274,23 @@ class Complex:
     (4, TType.LIST, 'lString', (TType.STRING,None), None, ), # 4
     (5, TType.LIST, 'lintString', (TType.STRUCT,(IntString, IntString.thrift_spec)), None, ), # 5
     (6, TType.MAP, 'mStringString', (TType.STRING,None,TType.STRING,None), None, ), # 6
+    (7, TType.MAP, 'attributes', (TType.STRING,None,TType.MAP,(TType.STRING,None,TType.MAP,(TType.STRING,None,TType.STRUCT,(PropValueUnion, PropValueUnion.thrift_spec)))), None, ), # 7
+    (8, TType.STRUCT, 'unionField1', (PropValueUnion, PropValueUnion.thrift_spec), None, ), # 8
+    (9, TType.STRUCT, 'unionField2', (PropValueUnion, PropValueUnion.thrift_spec), None, ), # 9
+    (10, TType.STRUCT, 'unionField3', (PropValueUnion, PropValueUnion.thrift_spec), None, ), # 10
   )
 
-  def __init__(self, aint=None, aString=None, lint=None, lString=None, lintString=None, mStringString=None,):
+  def __init__(self, aint=None, aString=None, lint=None, lString=None, lintString=None, mStringString=None, attributes=None, unionField1=None, unionField2=None, unionField3=None,):
     self.aint = aint
     self.aString = aString
     self.lint = lint
     self.lString = lString
     self.lintString = lintString
     self.mStringString = mStringString
+    self.attributes = attributes
+    self.unionField1 = unionField1
+    self.unionField2 = unionField2
+    self.unionField3 = unionField3
 
   def read(self, iprot):
     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
@@ -152,45 +314,87 @@ class Complex:
       elif fid == 3:
         if ftype == TType.LIST:
           self.lint = []
-          (_etype3, _size0) = iprot.readListBegin()
-          for _i4 in xrange(_size0):
-            _elem5 = iprot.readI32();
-            self.lint.append(_elem5)
+          (_etype19, _size16) = iprot.readListBegin()
+          for _i20 in xrange(_size16):
+            _elem21 = iprot.readI32();
+            self.lint.append(_elem21)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
       elif fid == 4:
         if ftype == TType.LIST:
           self.lString = []
-          (_etype9, _size6) = iprot.readListBegin()
-          for _i10 in xrange(_size6):
-            _elem11 = iprot.readString();
-            self.lString.append(_elem11)
+          (_etype25, _size22) = iprot.readListBegin()
+          for _i26 in xrange(_size22):
+            _elem27 = iprot.readString();
+            self.lString.append(_elem27)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
       elif fid == 5:
         if ftype == TType.LIST:
           self.lintString = []
-          (_etype15, _size12) = iprot.readListBegin()
-          for _i16 in xrange(_size12):
-            _elem17 = IntString()
-            _elem17.read(iprot)
-            self.lintString.append(_elem17)
+          (_etype31, _size28) = iprot.readListBegin()
+          for _i32 in xrange(_size28):
+            _elem33 = IntString()
+            _elem33.read(iprot)
+            self.lintString.append(_elem33)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
       elif fid == 6:
         if ftype == TType.MAP:
           self.mStringString = {}
-          (_ktype19, _vtype20, _size18 ) = iprot.readMapBegin() 
-          for _i22 in xrange(_size18):
-            _key23 = iprot.readString();
-            _val24 = iprot.readString();
-            self.mStringString[_key23] = _val24
+          (_ktype35, _vtype36, _size34 ) = iprot.readMapBegin() 
+          for _i38 in xrange(_size34):
+            _key39 = iprot.readString();
+            _val40 = iprot.readString();
+            self.mStringString[_key39] = _val40
+          iprot.readMapEnd()
+        else:
+          iprot.skip(ftype)
+      elif fid == 7:
+        if ftype == TType.MAP:
+          self.attributes = {}
+          (_ktype42, _vtype43, _size41 ) = iprot.readMapBegin() 
+          for _i45 in xrange(_size41):
+            _key46 = iprot.readString();
+            _val47 = {}
+            (_ktype49, _vtype50, _size48 ) = iprot.readMapBegin() 
+            for _i52 in xrange(_size48):
+              _key53 = iprot.readString();
+              _val54 = {}
+              (_ktype56, _vtype57, _size55 ) = iprot.readMapBegin() 
+              for _i59 in xrange(_size55):
+                _key60 = iprot.readString();
+                _val61 = PropValueUnion()
+                _val61.read(iprot)
+                _val54[_key60] = _val61
+              iprot.readMapEnd()
+              _val47[_key53] = _val54
+            iprot.readMapEnd()
+            self.attributes[_key46] = _val47
           iprot.readMapEnd()
         else:
           iprot.skip(ftype)
+      elif fid == 8:
+        if ftype == TType.STRUCT:
+          self.unionField1 = PropValueUnion()
+          self.unionField1.read(iprot)
+        else:
+          iprot.skip(ftype)
+      elif fid == 9:
+        if ftype == TType.STRUCT:
+          self.unionField2 = PropValueUnion()
+          self.unionField2.read(iprot)
+        else:
+          iprot.skip(ftype)
+      elif fid == 10:
+        if ftype == TType.STRUCT:
+          self.unionField3 = PropValueUnion()
+          self.unionField3.read(iprot)
+        else:
+          iprot.skip(ftype)
       else:
         iprot.skip(ftype)
       iprot.readFieldEnd()
@@ -212,32 +416,60 @@ class Complex:
     if self.lint is not None:
       oprot.writeFieldBegin('lint', TType.LIST, 3)
       oprot.writeListBegin(TType.I32, len(self.lint))
-      for iter25 in self.lint:
-        oprot.writeI32(iter25)
+      for iter62 in self.lint:
+        oprot.writeI32(iter62)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     if self.lString is not None:
       oprot.writeFieldBegin('lString', TType.LIST, 4)
       oprot.writeListBegin(TType.STRING, len(self.lString))
-      for iter26 in self.lString:
-        oprot.writeString(iter26)
+      for iter63 in self.lString:
+        oprot.writeString(iter63)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     if self.lintString is not None:
       oprot.writeFieldBegin('lintString', TType.LIST, 5)
       oprot.writeListBegin(TType.STRUCT, len(self.lintString))
-      for iter27 in self.lintString:
-        iter27.write(oprot)
+      for iter64 in self.lintString:
+        iter64.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     if self.mStringString is not None:
       oprot.writeFieldBegin('mStringString', TType.MAP, 6)
       oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.mStringString))
-      for kiter28,viter29 in self.mStringString.items():
-        oprot.writeString(kiter28)
-        oprot.writeString(viter29)
+      for kiter65,viter66 in self.mStringString.items():
+        oprot.writeString(kiter65)
+        oprot.writeString(viter66)
+      oprot.writeMapEnd()
+      oprot.writeFieldEnd()
+    if self.attributes is not None:
+      oprot.writeFieldBegin('attributes', TType.MAP, 7)
+      oprot.writeMapBegin(TType.STRING, TType.MAP, len(self.attributes))
+      for kiter67,viter68 in self.attributes.items():
+        oprot.writeString(kiter67)
+        oprot.writeMapBegin(TType.STRING, TType.MAP, len(viter68))
+        for kiter69,viter70 in viter68.items():
+          oprot.writeString(kiter69)
+          oprot.writeMapBegin(TType.STRING, TType.STRUCT, len(viter70))
+          for kiter71,viter72 in viter70.items():
+            oprot.writeString(kiter71)
+            viter72.write(oprot)
+          oprot.writeMapEnd()
+        oprot.writeMapEnd()
       oprot.writeMapEnd()
       oprot.writeFieldEnd()
+    if self.unionField1 is not None:
+      oprot.writeFieldBegin('unionField1', TType.STRUCT, 8)
+      self.unionField1.write(oprot)
+      oprot.writeFieldEnd()
+    if self.unionField2 is not None:
+      oprot.writeFieldBegin('unionField2', TType.STRUCT, 9)
+      self.unionField2.write(oprot)
+      oprot.writeFieldEnd()
+    if self.unionField3 is not None:
+      oprot.writeFieldBegin('unionField3', TType.STRUCT, 10)
+      self.unionField3.write(oprot)
+      oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 

Modified: hive/trunk/serde/src/gen/thrift/gen-rb/complex_types.rb
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-rb/complex_types.rb?rev=1625000&r1=1624999&r2=1625000&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-rb/complex_types.rb (original)
+++ hive/trunk/serde/src/gen/thrift/gen-rb/complex_types.rb Mon Sep 15 11:35:02 2014
@@ -6,6 +6,65 @@
 
 require 'thrift'
 
+class PropValueUnion < ::Thrift::Union
+  include ::Thrift::Struct_Union
+  class << self
+    def intValue(val)
+      PropValueUnion.new(:intValue, val)
+    end
+
+    def longValue(val)
+      PropValueUnion.new(:longValue, val)
+    end
+
+    def stringValue(val)
+      PropValueUnion.new(:stringValue, val)
+    end
+
+    def doubleValue(val)
+      PropValueUnion.new(:doubleValue, val)
+    end
+
+    def flag(val)
+      PropValueUnion.new(:flag, val)
+    end
+
+    def lString(val)
+      PropValueUnion.new(:lString, val)
+    end
+
+    def unionMStringString(val)
+      PropValueUnion.new(:unionMStringString, val)
+    end
+  end
+
+  INTVALUE = 1
+  LONGVALUE = 2
+  STRINGVALUE = 3
+  DOUBLEVALUE = 4
+  FLAG = 5
+  LSTRING = 6
+  UNIONMSTRINGSTRING = 7
+
+  FIELDS = {
+    INTVALUE => {:type => ::Thrift::Types::I32, :name => 'intValue', :optional => true},
+    LONGVALUE => {:type => ::Thrift::Types::I64, :name => 'longValue', :optional => true},
+    STRINGVALUE => {:type => ::Thrift::Types::STRING, :name => 'stringValue', :optional => true},
+    DOUBLEVALUE => {:type => ::Thrift::Types::DOUBLE, :name => 'doubleValue', :optional => true},
+    FLAG => {:type => ::Thrift::Types::BOOL, :name => 'flag', :optional => true},
+    LSTRING => {:type => ::Thrift::Types::LIST, :name => 'lString', :element => {:type => ::Thrift::Types::STRING}},
+    UNIONMSTRINGSTRING => {:type => ::Thrift::Types::MAP, :name => 'unionMStringString', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}}
+  }
+
+  def struct_fields; FIELDS; end
+
+  def validate
+    raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
+  end
+
+  ::Thrift::Union.generate_accessors self
+end
+
 class IntString
   include ::Thrift::Struct, ::Thrift::Struct_Union
   MYINT = 1
@@ -34,6 +93,10 @@ class Complex
   LSTRING = 4
   LINTSTRING = 5
   MSTRINGSTRING = 6
+  ATTRIBUTES = 7
+  UNIONFIELD1 = 8
+  UNIONFIELD2 = 9
+  UNIONFIELD3 = 10
 
   FIELDS = {
     AINT => {:type => ::Thrift::Types::I32, :name => 'aint'},
@@ -41,7 +104,11 @@ class Complex
     LINT => {:type => ::Thrift::Types::LIST, :name => 'lint', :element => {:type => ::Thrift::Types::I32}},
     LSTRING => {:type => ::Thrift::Types::LIST, :name => 'lString', :element => {:type => ::Thrift::Types::STRING}},
     LINTSTRING => {:type => ::Thrift::Types::LIST, :name => 'lintString', :element => {:type => ::Thrift::Types::STRUCT, :class => ::IntString}},
-    MSTRINGSTRING => {:type => ::Thrift::Types::MAP, :name => 'mStringString', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}}
+    MSTRINGSTRING => {:type => ::Thrift::Types::MAP, :name => 'mStringString', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
+    ATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'attributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRUCT, :class => ::PropValueUnion}}}},
+    UNIONFIELD1 => {:type => ::Thrift::Types::STRUCT, :name => 'unionField1', :class => ::PropValueUnion},
+    UNIONFIELD2 => {:type => ::Thrift::Types::STRUCT, :name => 'unionField2', :class => ::PropValueUnion},
+    UNIONFIELD3 => {:type => ::Thrift::Types::STRUCT, :name => 'unionField3', :class => ::PropValueUnion}
   }
 
   def struct_fields; FIELDS; end

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java?rev=1625000&r1=1624999&r2=1625000&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java Mon Sep 15 11:35:02 2014
@@ -31,6 +31,7 @@ import java.util.concurrent.ConcurrentHa
 
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
+import org.apache.thrift.TUnion;
 
 /**
  * ObjectInspectorFactory is the primary way to create new ObjectInspector
@@ -174,7 +175,7 @@ public final class ObjectInspectorFactor
       oi = new ReflectionStructObjectInspector();
       break;
     case THRIFT:
-      oi = new ThriftStructObjectInspector();
+      oi = TUnion.class.isAssignableFrom(c) ? new ThriftUnionObjectInspector() : new ThriftStructObjectInspector();
       break;
     case PROTOCOL_BUFFERS:
       oi = new ProtocolBuffersStructObjectInspector();
@@ -183,20 +184,13 @@ public final class ObjectInspectorFactor
       throw new RuntimeException(ObjectInspectorFactory.class.getName()
           + ": internal error.");
     }
+
     // put it into the cache BEFORE it is initialized to make sure we can catch
     // recursive types.
     objectInspectorCache.put(t, oi);
-    Field[] fields = ObjectInspectorUtils.getDeclaredNonStaticFields(c);
-    ArrayList<ObjectInspector> structFieldObjectInspectors = new ArrayList<ObjectInspector>(
-        fields.length);
-    for (int i = 0; i < fields.length; i++) {
-      if (!oi.shouldIgnoreField(fields[i].getName())) {
-        structFieldObjectInspectors.add(getReflectionObjectInspector(fields[i]
-            .getGenericType(), options));
-      }
-    }
-    oi.init(c, structFieldObjectInspectors);
+    oi.init(c, options);
     return oi;
+
   }
 
   static ConcurrentHashMap<ObjectInspector, StandardListObjectInspector> cachedStandardListObjectInspector =

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java?rev=1625000&r1=1624999&r2=1625000&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java Mon Sep 15 11:35:02 2014
@@ -44,6 +44,7 @@ public class ReflectionStructObjectInspe
   public static class MyField implements StructField {
     protected int fieldID;
     protected Field field;
+
     protected ObjectInspector fieldObjectInspector;
 
     protected MyField() {
@@ -116,12 +117,13 @@ public class ReflectionStructObjectInspe
    * The reason that this method is not recursive by itself is because we want
    * to allow recursive types.
    */
-  void init(Class<?> objectClass,
-      List<ObjectInspector> structFieldObjectInspectors) {
-    assert (!List.class.isAssignableFrom(objectClass));
-    assert (!Map.class.isAssignableFrom(objectClass));
+  protected void init(Class<?> objectClass,
+      ObjectInspectorFactory.ObjectInspectorOptions options) {
 
+    verifyObjectClassType(objectClass);
     this.objectClass = objectClass;
+    final List<? extends ObjectInspector> structFieldObjectInspectors = extractFieldObjectInspectors(objectClass, options);
+
     Field[] reflectionFields = ObjectInspectorUtils
         .getDeclaredNonStaticFields(objectClass);
     fields = new ArrayList<MyField>(structFieldObjectInspectors.size());
@@ -205,4 +207,23 @@ public class ReflectionStructObjectInspe
     return struct;
   }
 
+  protected List<? extends ObjectInspector> extractFieldObjectInspectors(Class<?> clazz,
+    ObjectInspectorFactory.ObjectInspectorOptions options) {
+    Field[] fields = ObjectInspectorUtils.getDeclaredNonStaticFields(clazz);
+    ArrayList<ObjectInspector> structFieldObjectInspectors = new ArrayList<ObjectInspector>(
+      fields.length);
+    for (int i = 0; i < fields.length; i++) {
+      if (!shouldIgnoreField(fields[i].getName())) {
+        structFieldObjectInspectors.add(ObjectInspectorFactory.getReflectionObjectInspector(fields[i]
+          .getGenericType(), options));
+      }
+    }
+    return structFieldObjectInspectors;
+  }
+
+
+  protected void verifyObjectClassType(Class<?> objectClass) {
+    assert (!List.class.isAssignableFrom(objectClass));
+    assert (!Map.class.isAssignableFrom(objectClass));
+  }
 }

Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftObjectInspectorUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftObjectInspectorUtils.java?rev=1625000&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftObjectInspectorUtils.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftObjectInspectorUtils.java Mon Sep 15 11:35:02 2014
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.serde2.objectinspector;
+
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+public class ThriftObjectInspectorUtils {
+
+  /**
+   * Returns generic type for a field in a Thrift class. The type is the return
+   * type for the accessor method for the field (e.g. <code>isFieldName()</code>
+   * for a boolean type or <code>getFieldName</code> for other types). The return
+   * type works for both structs and unions. Reflecting directly based on
+   * fields does not work for unions.
+   *
+   * @return generic {@link Type} of the thrift field.
+   */
+  public static Type getFieldType(Class<?> containingClass, String fieldName) {
+
+    String suffix = // uppercase first letter
+      fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
+
+    // look for getFieldName() or isFieldName()
+
+    for(String prefix : new String[]{"get", "is"}) {
+      try {
+        Method method = containingClass.getDeclaredMethod(prefix + suffix);
+        return method.getGenericReturnType();
+      } catch (NoSuchMethodException e) {
+      }
+    }
+
+    // look for bean style accessors get_fieldName and is_fieldName
+
+    for(String prefix : new String[]{"get_", "is_"}) {
+      try {
+        Method method = containingClass.getDeclaredMethod(prefix + fieldName);
+        return method.getGenericReturnType();
+      } catch (NoSuchMethodException e) {
+      }
+    }
+
+    throw new RuntimeException("Could not find type for " + fieldName +
+                                       " in " + containingClass);
+  }
+
+}

Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftUnionObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftUnionObjectInspector.java?rev=1625000&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftUnionObjectInspector.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ThriftUnionObjectInspector.java Mon Sep 15 11:35:02 2014
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.serde2.objectinspector;
+
+import com.google.common.primitives.UnsignedBytes;
+import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.thrift.TFieldIdEnum;
+import org.apache.thrift.TUnion;
+import org.apache.thrift.meta_data.FieldMetaData;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Always use the ObjectInspectorFactory to create new ObjectInspector objects,
+ * instead of directly creating an instance of this class.
+ */
+public class ThriftUnionObjectInspector extends ReflectionStructObjectInspector implements UnionObjectInspector {
+
+  private static final String FIELD_METADATA_MAP = "metaDataMap";
+  private  List<ObjectInspector> ois;
+
+  @Override
+  public boolean shouldIgnoreField(String name) {
+    return name.startsWith("__isset");
+  }
+
+  @Override
+  public List<ObjectInspector> getObjectInspectors() {
+    return ois;
+  }
+
+  @Override
+  public byte getTag(final Object o) {
+    if (o == null) {
+      return -1;
+    }
+    final TFieldIdEnum setField = ((TUnion<? extends TUnion<?, ?>, ? extends TFieldIdEnum>) o).getSetField();
+    return UnsignedBytes.checkedCast((setField.getThriftFieldId() - 1));
+  }
+
+  @Override
+  public Object getField(final Object o) {
+    if (o == null) {
+      return null;
+    }
+    return ((TUnion<? extends TUnion<?, ?>, ? extends TFieldIdEnum>) o).getFieldValue();
+  }
+
+  /**
+   * This method is only intended to be used by Utilities class in this package.
+   * The reason that this method is not recursive by itself is because we want
+   * to allow recursive types.
+   */
+  @Override
+  protected void init(Class<?> objectClass,
+                      ObjectInspectorFactory.ObjectInspectorOptions options) {
+    verifyObjectClassType(objectClass);
+    this.objectClass = objectClass;
+    final Field fieldMetaData;
+
+    try {
+      fieldMetaData = objectClass.getDeclaredField(FIELD_METADATA_MAP);
+      assert(Map.class.isAssignableFrom(fieldMetaData.getType()));
+      fieldMetaData.setAccessible(true);
+    } catch (NoSuchFieldException e) {
+      throw new RuntimeException("Unable to find field metadata for thrift union field " , e);
+    }
+
+    try {
+      final Map<? extends TFieldIdEnum, FieldMetaData> fieldMap = (Map<? extends TFieldIdEnum, FieldMetaData>) fieldMetaData.get(null);
+      this.ois = new ArrayList<ObjectInspector>();
+      for(Map.Entry<? extends TFieldIdEnum, FieldMetaData> metadata : fieldMap.entrySet()) {
+        final Type fieldType = ThriftObjectInspectorUtils.getFieldType(objectClass, metadata.getValue().fieldName);
+        final ObjectInspector reflectionObjectInspector = ObjectInspectorFactory.getReflectionObjectInspector(fieldType, options);
+        this.ois.add(reflectionObjectInspector);
+      }
+    } catch (IllegalAccessException e) {
+      throw new RuntimeException("Unable to find field metadata for thrift union field ", e);
+    }
+  }
+
+  @Override
+  public Category getCategory() {
+    return Category.UNION;
+  }
+
+  @Override
+  public List<? extends StructField> getAllStructFieldRefs() {
+    return fields;
+  }
+
+  public String getTypeName() {
+    return ObjectInspectorUtils.getStandardUnionTypeName(this);
+  }
+
+  @Override
+  public Object create() {
+    return ReflectionUtils.newInstance(objectClass, null);
+  }
+}
+

Modified: hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestObjectInspectorUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestObjectInspectorUtils.java?rev=1625000&r1=1624999&r2=1625000&view=diff
==============================================================================
--- hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestObjectInspectorUtils.java (original)
+++ hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestObjectInspectorUtils.java Mon Sep 15 11:35:02 2014
@@ -46,7 +46,7 @@ public class TestObjectInspectorUtils ex
       StructObjectInspector soi = (StructObjectInspector) ObjectInspectorUtils
           .getStandardObjectInspector(oi1);
       List<? extends StructField> fields = soi.getAllStructFieldRefs();
-      assertEquals(6, fields.size());
+      assertEquals(10, fields.size());
       assertEquals(fields.get(0), soi.getStructFieldRef("aint"));
 
       // null
@@ -75,7 +75,7 @@ public class TestObjectInspectorUtils ex
       assertEquals(c4, soi.getStructFieldData(c, fields.get(4)));
       assertNull(soi.getStructFieldData(c, fields.get(5)));
       ArrayList<Object> cfields = new ArrayList<Object>();
-      for (int i = 0; i < 6; i++) {
+      for (int i = 0; i < 10; i++) {
         cfields.add(soi.getStructFieldData(c, fields.get(i)));
       }
       assertEquals(cfields, soi.getStructFieldsDataAsList(c));

Modified: hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestThriftObjectInspectors.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestThriftObjectInspectors.java?rev=1625000&r1=1624999&r2=1625000&view=diff
==============================================================================
--- hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestThriftObjectInspectors.java (original)
+++ hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestThriftObjectInspectors.java Mon Sep 15 11:35:02 2014
@@ -52,7 +52,7 @@ public class TestThriftObjectInspectors 
       assertEquals(Category.STRUCT, oi1.getCategory());
       StructObjectInspector soi = (StructObjectInspector) oi1;
       List<? extends StructField> fields = soi.getAllStructFieldRefs();
-      assertEquals(6, fields.size());
+      assertEquals(10, fields.size());
       assertEquals(fields.get(0), soi.getStructFieldRef("aint"));
 
       // null
@@ -71,6 +71,10 @@ public class TestThriftObjectInspectors 
       List<IntString> c4 = new ArrayList<IntString>();
       c.setLintString(c4);
       c.setMStringString(null);
+      c.setAttributes(null);
+      c.setUnionField1(null);
+      c.setUnionField2(null);
+      c.setUnionField3(null);
 
       assertEquals(1, soi.getStructFieldData(c, fields.get(0)));
       assertEquals("test", soi.getStructFieldData(c, fields.get(1)));
@@ -78,8 +82,13 @@ public class TestThriftObjectInspectors 
       assertEquals(c3, soi.getStructFieldData(c, fields.get(3)));
       assertEquals(c4, soi.getStructFieldData(c, fields.get(4)));
       assertNull(soi.getStructFieldData(c, fields.get(5)));
+      assertNull(soi.getStructFieldData(c, fields.get(6)));
+      assertNull(soi.getStructFieldData(c, fields.get(7)));
+      assertNull(soi.getStructFieldData(c, fields.get(8)));
+      assertNull(soi.getStructFieldData(c, fields.get(9)));
+
       ArrayList<Object> cfields = new ArrayList<Object>();
-      for (int i = 0; i < 6; i++) {
+      for (int i = 0; i < 10; i++) {
         cfields.add(soi.getStructFieldData(c, fields.get(i)));
       }
       assertEquals(cfields, soi.getStructFieldsDataAsList(c));

Modified: hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/thrift_test/CreateSequenceFile.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/thrift_test/CreateSequenceFile.java?rev=1625000&r1=1624999&r2=1625000&view=diff
==============================================================================
--- hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/thrift_test/CreateSequenceFile.java (original)
+++ hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/thrift_test/CreateSequenceFile.java Mon Sep 15 11:35:02 2014
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hive.serde2.thrift_test;
 
 import java.util.ArrayList;
+import java.util.Map;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Random;
@@ -28,6 +29,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hive.serde2.ByteStream;
 import org.apache.hadoop.hive.serde2.thrift.test.Complex;
 import org.apache.hadoop.hive.serde2.thrift.test.IntString;
+import org.apache.hadoop.hive.serde2.thrift.test.PropValueUnion;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Writable;
@@ -125,16 +127,23 @@ public final class CreateSequenceFile {
       islist.add(new IntString(i * i, "" + i * i * i, i));
       HashMap<String, String> hash = new HashMap<String, String>();
       hash.put("key_" + i, "value_" + i);
+      Map<String, Map<String, Map<String,PropValueUnion>>> unionMap = new HashMap<String, Map<String, Map<String,PropValueUnion>>>();
+      Map<String, Map<String, PropValueUnion>> erMap = new HashMap<String, Map<String, PropValueUnion>>();
+      Map<String, PropValueUnion> attrMap = new HashMap<String, PropValueUnion>();
+
+      erMap.put("erVal" + i, attrMap);
+      attrMap.put("value_" + i, PropValueUnion.doubleValue(1.0));
+      unionMap.put("key_" + i,  erMap);
 
       Complex complex = new Complex(rand.nextInt(), "record_"
-          + (new Integer(i)).toString(), alist, slist, islist, hash);
+          + (new Integer(i)).toString(), alist, slist, islist, hash, unionMap, PropValueUnion.stringValue("test" + i), PropValueUnion.unionMStringString(hash), PropValueUnion.lString(slist));
 
       Writable value = serializer.serialize(complex);
       writer.append(key, value);
     }
 
     // Add an all-null record
-    Complex complex = new Complex(0, null, null, null, null, null);
+    Complex complex = new Complex(0, null, null, null, null, null, null, null, null, null);
     Writable value = serializer.serialize(complex);
     writer.append(key, value);
 



Mime
View raw message