hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1429194 [1/2] - in /hive/trunk/serde/src: java/org/apache/hadoop/hive/serde2/objectinspector/ java/org/apache/hadoop/hive/serde2/typeinfo/ test/org/apache/hadoop/hive/serde2/thrift_test/
Date Sat, 05 Jan 2013 02:11:41 GMT
Author: hashutosh
Date: Sat Jan  5 02:11:41 2013
New Revision: 1429194

URL: http://svn.apache.org/viewvc?rev=1429194&view=rev
Log:
HIVE-3858 : Normalize left over CRLF files (Mark Grover via Ashutosh Chauhan)

Modified:
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardUnionObjectInspector.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionObjectInspector.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
    hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/thrift_test/CreateSequenceFile.java

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardUnionObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardUnionObjectInspector.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardUnionObjectInspector.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardUnionObjectInspector.java Sat Jan  5 02:11:41 2013
@@ -1,116 +1,116 @@
-/**
- * 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.util.List;
-
-/**
- * StandardUnionObjectInspector works on union data that is stored as
- * UnionObject.
- * It holds the list of the object inspectors corresponding to each type of the
- * object the Union can hold. The UniobObject has tag followed by the object
- * it is holding.
- *
- * Always use the {@link ObjectInspectorFactory} to create new ObjectInspector
- * objects, instead of directly creating an instance of this class.
- */
-public class StandardUnionObjectInspector implements UnionObjectInspector {
-  List<ObjectInspector> ois;
-
-  public StandardUnionObjectInspector(List<ObjectInspector> ois) {
-    this.ois = ois;
-  }
-
-  public List<ObjectInspector> getObjectInspectors() {
-    return ois;
-  }
-
-  public static class StandardUnion implements UnionObject {
-    protected byte tag;
-    protected Object object;
-
-    public StandardUnion() {
-    }
-
-    public StandardUnion(byte tag, Object object) {
-      this.tag = tag;
-      this.object = object;
-    }
-
-    public void setObject(Object o) {
-      this.object = o;
-    }
-
-    public void setTag(byte tag) {
-      this.tag = tag;
-    }
-
-    @Override
-    public Object getObject() {
-      return object;
-    }
-
-    @Override
-    public byte getTag() {
-      return tag;
-    }
-
-    @Override
-    public String toString() {
-      return tag + ":" + object;
-    }
-  }
-
-  /**
-   * Return the tag of the object.
-   */
-  public byte getTag(Object o) {
-    if (o == null) {
-      return -1;
-    }
-    return ((UnionObject) o).getTag();
-  }
-
-  /**
-   * Return the field based on the tag value associated with the Object.
-   */
-  public Object getField(Object o) {
-    if (o == null) {
-      return null;
-    }
-    return ((UnionObject) o).getObject();
-  }
-
-  public Category getCategory() {
-    return Category.UNION;
-  }
-
-  public String getTypeName() {
-    return ObjectInspectorUtils.getStandardUnionTypeName(this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append(getClass().getName());
-    sb.append(getTypeName());
-    return sb.toString();
-  }
-
-}
+/**
+ * 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.util.List;
+
+/**
+ * StandardUnionObjectInspector works on union data that is stored as
+ * UnionObject.
+ * It holds the list of the object inspectors corresponding to each type of the
+ * object the Union can hold. The UniobObject has tag followed by the object
+ * it is holding.
+ *
+ * Always use the {@link ObjectInspectorFactory} to create new ObjectInspector
+ * objects, instead of directly creating an instance of this class.
+ */
+public class StandardUnionObjectInspector implements UnionObjectInspector {
+  List<ObjectInspector> ois;
+
+  public StandardUnionObjectInspector(List<ObjectInspector> ois) {
+    this.ois = ois;
+  }
+
+  public List<ObjectInspector> getObjectInspectors() {
+    return ois;
+  }
+
+  public static class StandardUnion implements UnionObject {
+    protected byte tag;
+    protected Object object;
+
+    public StandardUnion() {
+    }
+
+    public StandardUnion(byte tag, Object object) {
+      this.tag = tag;
+      this.object = object;
+    }
+
+    public void setObject(Object o) {
+      this.object = o;
+    }
+
+    public void setTag(byte tag) {
+      this.tag = tag;
+    }
+
+    @Override
+    public Object getObject() {
+      return object;
+    }
+
+    @Override
+    public byte getTag() {
+      return tag;
+    }
+
+    @Override
+    public String toString() {
+      return tag + ":" + object;
+    }
+  }
+
+  /**
+   * Return the tag of the object.
+   */
+  public byte getTag(Object o) {
+    if (o == null) {
+      return -1;
+    }
+    return ((UnionObject) o).getTag();
+  }
+
+  /**
+   * Return the field based on the tag value associated with the Object.
+   */
+  public Object getField(Object o) {
+    if (o == null) {
+      return null;
+    }
+    return ((UnionObject) o).getObject();
+  }
+
+  public Category getCategory() {
+    return Category.UNION;
+  }
+
+  public String getTypeName() {
+    return ObjectInspectorUtils.getStandardUnionTypeName(this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    sb.append(getClass().getName());
+    sb.append(getTypeName());
+    return sb.toString();
+  }
+
+}

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionObjectInspector.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionObjectInspector.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionObjectInspector.java Sat Jan  5 02:11:41 2013
@@ -1,49 +1,49 @@
-/**
- * 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.util.List;
-
-/**
- * UnionObjectInspector works on union data that is stored as UnionObject.
- *
- * It holds the list of the object inspectors corresponding to each type of the
- * object the Union can hold.
- *
- * UnionObjectInspector.
- *
- */
-public interface UnionObjectInspector extends ObjectInspector {
-
-  /**
-   *  Returns the array of ObjectInspectors that are for each of the tags.
-   */
-  List<ObjectInspector> getObjectInspectors();
-
-  /**
-   *   Return the tag of the object.
-   */
-  byte getTag(Object o);
-
-  /**
-   *  Return the field based on the tag associated with the Object.
-   */
-  Object getField(Object o);
-
-}
+/**
+ * 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.util.List;
+
+/**
+ * UnionObjectInspector works on union data that is stored as UnionObject.
+ *
+ * It holds the list of the object inspectors corresponding to each type of the
+ * object the Union can hold.
+ *
+ * UnionObjectInspector.
+ *
+ */
+public interface UnionObjectInspector extends ObjectInspector {
+
+  /**
+   *  Returns the array of ObjectInspectors that are for each of the tags.
+   */
+  List<ObjectInspector> getObjectInspectors();
+
+  /**
+   *   Return the tag of the object.
+   */
+  byte getTag(Object o);
+
+  /**
+   *  Return the field based on the tag associated with the Object.
+   */
+  Object getField(Object o);
+
+}

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java Sat Jan  5 02:11:41 2013
@@ -1,89 +1,89 @@
-/**
- * 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.typeinfo;
-
-import java.io.Serializable;
-
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
-
-/**
- * A List Type has homogeneous elements. All elements of the List has the same
- * TypeInfo which is returned by getListElementTypeInfo.
- * 
- * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
- * directly creating an instance of this class.
- */
-public final class ListTypeInfo extends TypeInfo implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-  private TypeInfo listElementTypeInfo;
-
-  /**
-   * For java serialization use only.
-   */
-  public ListTypeInfo() {
-  }
-
-  @Override
-  public String getTypeName() {
-    return org.apache.hadoop.hive.serde.serdeConstants.LIST_TYPE_NAME + "<"
-        + listElementTypeInfo.getTypeName() + ">";
-  }
-
-  /**
-   * For java serialization use only.
-   */
-  public void setListElementTypeInfo(TypeInfo listElementTypeInfo) {
-    this.listElementTypeInfo = listElementTypeInfo;
-  }
-
-  /**
-   * For TypeInfoFactory use only.
-   */
-  ListTypeInfo(TypeInfo elementTypeInfo) {
-    listElementTypeInfo = elementTypeInfo;
-  }
-
-  @Override
-  public Category getCategory() {
-    return Category.LIST;
-  }
-
-  public TypeInfo getListElementTypeInfo() {
-    return listElementTypeInfo;
-  }
-
-  @Override
-  public boolean equals(Object other) {
-    if (this == other) {
-      return true;
-    }
-    if (!(other instanceof ListTypeInfo)) {
-      return false;
-    }
-    return getListElementTypeInfo().equals(
-        ((ListTypeInfo) other).getListElementTypeInfo());
-  }
-
-  @Override
-  public int hashCode() {
-    return listElementTypeInfo.hashCode();
-  }
-
-}
+/**
+ * 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.typeinfo;
+
+import java.io.Serializable;
+
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
+
+/**
+ * A List Type has homogeneous elements. All elements of the List has the same
+ * TypeInfo which is returned by getListElementTypeInfo.
+ * 
+ * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
+ * directly creating an instance of this class.
+ */
+public final class ListTypeInfo extends TypeInfo implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+  private TypeInfo listElementTypeInfo;
+
+  /**
+   * For java serialization use only.
+   */
+  public ListTypeInfo() {
+  }
+
+  @Override
+  public String getTypeName() {
+    return org.apache.hadoop.hive.serde.serdeConstants.LIST_TYPE_NAME + "<"
+        + listElementTypeInfo.getTypeName() + ">";
+  }
+
+  /**
+   * For java serialization use only.
+   */
+  public void setListElementTypeInfo(TypeInfo listElementTypeInfo) {
+    this.listElementTypeInfo = listElementTypeInfo;
+  }
+
+  /**
+   * For TypeInfoFactory use only.
+   */
+  ListTypeInfo(TypeInfo elementTypeInfo) {
+    listElementTypeInfo = elementTypeInfo;
+  }
+
+  @Override
+  public Category getCategory() {
+    return Category.LIST;
+  }
+
+  public TypeInfo getListElementTypeInfo() {
+    return listElementTypeInfo;
+  }
+
+  @Override
+  public boolean equals(Object other) {
+    if (this == other) {
+      return true;
+    }
+    if (!(other instanceof ListTypeInfo)) {
+      return false;
+    }
+    return getListElementTypeInfo().equals(
+        ((ListTypeInfo) other).getListElementTypeInfo());
+  }
+
+  @Override
+  public int hashCode() {
+    return listElementTypeInfo.hashCode();
+  }
+
+}

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java Sat Jan  5 02:11:41 2013
@@ -1,105 +1,105 @@
-/**
- * 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.typeinfo;
-
-import java.io.Serializable;
-
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
-
-/**
- * A Map Type has homogeneous keys and homogeneous values. All keys of the Map
- * have the same TypeInfo, which is returned by getMapKeyTypeInfo(); and all
- * values of the Map has the same TypeInfo, which is returned by
- * getMapValueTypeInfo().
- * 
- * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
- * directly creating an instance of this class.
- */
-public final class MapTypeInfo extends TypeInfo implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  private TypeInfo mapKeyTypeInfo;
-  private TypeInfo mapValueTypeInfo;
-
-  /**
-   * For java serialization use only.
-   */
-  public MapTypeInfo() {
-  }
-
-  @Override
-  public String getTypeName() {
-    return org.apache.hadoop.hive.serde.serdeConstants.MAP_TYPE_NAME + "<"
-        + mapKeyTypeInfo.getTypeName() + "," + mapValueTypeInfo.getTypeName()
-        + ">";
-  }
-
-  /**
-   * For java serialization use only.
-   */
-  public void setMapKeyTypeInfo(TypeInfo mapKeyTypeInfo) {
-    this.mapKeyTypeInfo = mapKeyTypeInfo;
-  }
-
-  /**
-   * For java serialization use only.
-   */
-  public void setMapValueTypeInfo(TypeInfo mapValueTypeInfo) {
-    this.mapValueTypeInfo = mapValueTypeInfo;
-  }
-
-  // For TypeInfoFactory use only
-  MapTypeInfo(TypeInfo keyTypeInfo, TypeInfo valueTypeInfo) {
-    mapKeyTypeInfo = keyTypeInfo;
-    mapValueTypeInfo = valueTypeInfo;
-  }
-
-  @Override
-  public Category getCategory() {
-    return Category.MAP;
-  }
-
-  public TypeInfo getMapKeyTypeInfo() {
-    return mapKeyTypeInfo;
-  }
-
-  public TypeInfo getMapValueTypeInfo() {
-    return mapValueTypeInfo;
-  }
-
-  @Override
-  public boolean equals(Object other) {
-    if (this == other) {
-      return true;
-    }
-    if (!(other instanceof MapTypeInfo)) {
-      return false;
-    }
-    MapTypeInfo o = (MapTypeInfo) other;
-    return o.getMapKeyTypeInfo().equals(getMapKeyTypeInfo())
-        && o.getMapValueTypeInfo().equals(getMapValueTypeInfo());
-  }
-
-  @Override
-  public int hashCode() {
-    return mapKeyTypeInfo.hashCode() ^ mapValueTypeInfo.hashCode();
-  }
-
-}
+/**
+ * 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.typeinfo;
+
+import java.io.Serializable;
+
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
+
+/**
+ * A Map Type has homogeneous keys and homogeneous values. All keys of the Map
+ * have the same TypeInfo, which is returned by getMapKeyTypeInfo(); and all
+ * values of the Map has the same TypeInfo, which is returned by
+ * getMapValueTypeInfo().
+ * 
+ * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
+ * directly creating an instance of this class.
+ */
+public final class MapTypeInfo extends TypeInfo implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private TypeInfo mapKeyTypeInfo;
+  private TypeInfo mapValueTypeInfo;
+
+  /**
+   * For java serialization use only.
+   */
+  public MapTypeInfo() {
+  }
+
+  @Override
+  public String getTypeName() {
+    return org.apache.hadoop.hive.serde.serdeConstants.MAP_TYPE_NAME + "<"
+        + mapKeyTypeInfo.getTypeName() + "," + mapValueTypeInfo.getTypeName()
+        + ">";
+  }
+
+  /**
+   * For java serialization use only.
+   */
+  public void setMapKeyTypeInfo(TypeInfo mapKeyTypeInfo) {
+    this.mapKeyTypeInfo = mapKeyTypeInfo;
+  }
+
+  /**
+   * For java serialization use only.
+   */
+  public void setMapValueTypeInfo(TypeInfo mapValueTypeInfo) {
+    this.mapValueTypeInfo = mapValueTypeInfo;
+  }
+
+  // For TypeInfoFactory use only
+  MapTypeInfo(TypeInfo keyTypeInfo, TypeInfo valueTypeInfo) {
+    mapKeyTypeInfo = keyTypeInfo;
+    mapValueTypeInfo = valueTypeInfo;
+  }
+
+  @Override
+  public Category getCategory() {
+    return Category.MAP;
+  }
+
+  public TypeInfo getMapKeyTypeInfo() {
+    return mapKeyTypeInfo;
+  }
+
+  public TypeInfo getMapValueTypeInfo() {
+    return mapValueTypeInfo;
+  }
+
+  @Override
+  public boolean equals(Object other) {
+    if (this == other) {
+      return true;
+    }
+    if (!(other instanceof MapTypeInfo)) {
+      return false;
+    }
+    MapTypeInfo o = (MapTypeInfo) other;
+    return o.getMapKeyTypeInfo().equals(getMapKeyTypeInfo())
+        && o.getMapValueTypeInfo().equals(getMapValueTypeInfo());
+  }
+
+  @Override
+  public int hashCode() {
+    return mapKeyTypeInfo.hashCode() ^ mapValueTypeInfo.hashCode();
+  }
+
+}

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java Sat Jan  5 02:11:41 2013
@@ -1,100 +1,100 @@
-/**
- * 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.typeinfo;
-
-import java.io.Serializable;
-
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
-import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
-
-/**
- * There are limited number of Primitive Types. All Primitive Types are defined
- * by TypeInfoFactory.isPrimitiveClass().
- * 
- * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
- * directly creating an instance of this class.
- */
-public final class PrimitiveTypeInfo extends TypeInfo implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  private String typeName;
-
-  /**
-   * For java serialization use only.
-   */
-  public PrimitiveTypeInfo() {
-  }
-
-  /**
-   * For TypeInfoFactory use only.
-   */
-  PrimitiveTypeInfo(String typeName) {
-    this.typeName = typeName;
-  }
-
-  /**
-   * Returns the category of this TypeInfo.
-   */
-  @Override
-  public Category getCategory() {
-    return Category.PRIMITIVE;
-  }
-
-  public PrimitiveCategory getPrimitiveCategory() {
-    return PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName).primitiveCategory;
-  }
-
-  public Class<?> getPrimitiveWritableClass() {
-    return PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName).primitiveWritableClass;
-  }
-
-  public Class<?> getPrimitiveJavaClass() {
-    return PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName).primitiveJavaClass;
-  }
-
-  // The following 2 methods are for java serialization use only.
-  public void setTypeName(String typeName) {
-    this.typeName = typeName;
-  }
-
-  @Override
-  public String getTypeName() {
-    return typeName;
-  }
-
-  /**
-   * Compare if 2 TypeInfos are the same. We use TypeInfoFactory to cache
-   * TypeInfos, so we only need to compare the Object pointer.
-   */
-  @Override
-  public boolean equals(Object other) {
-    return this == other;
-  }
-
-  /**
-   * Generate the hashCode for this TypeInfo.
-   */
-  @Override
-  public int hashCode() {
-    return typeName.hashCode();
-  }
-
-}
+/**
+ * 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.typeinfo;
+
+import java.io.Serializable;
+
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
+
+/**
+ * There are limited number of Primitive Types. All Primitive Types are defined
+ * by TypeInfoFactory.isPrimitiveClass().
+ * 
+ * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
+ * directly creating an instance of this class.
+ */
+public final class PrimitiveTypeInfo extends TypeInfo implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private String typeName;
+
+  /**
+   * For java serialization use only.
+   */
+  public PrimitiveTypeInfo() {
+  }
+
+  /**
+   * For TypeInfoFactory use only.
+   */
+  PrimitiveTypeInfo(String typeName) {
+    this.typeName = typeName;
+  }
+
+  /**
+   * Returns the category of this TypeInfo.
+   */
+  @Override
+  public Category getCategory() {
+    return Category.PRIMITIVE;
+  }
+
+  public PrimitiveCategory getPrimitiveCategory() {
+    return PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName).primitiveCategory;
+  }
+
+  public Class<?> getPrimitiveWritableClass() {
+    return PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName).primitiveWritableClass;
+  }
+
+  public Class<?> getPrimitiveJavaClass() {
+    return PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName).primitiveJavaClass;
+  }
+
+  // The following 2 methods are for java serialization use only.
+  public void setTypeName(String typeName) {
+    this.typeName = typeName;
+  }
+
+  @Override
+  public String getTypeName() {
+    return typeName;
+  }
+
+  /**
+   * Compare if 2 TypeInfos are the same. We use TypeInfoFactory to cache
+   * TypeInfos, so we only need to compare the Object pointer.
+   */
+  @Override
+  public boolean equals(Object other) {
+    return this == other;
+  }
+
+  /**
+   * Generate the hashCode for this TypeInfo.
+   */
+  @Override
+  public int hashCode() {
+    return typeName.hashCode();
+  }
+
+}

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java Sat Jan  5 02:11:41 2013
@@ -1,147 +1,147 @@
-/**
- * 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.typeinfo;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.hadoop.hive.serde.serdeConstants;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
-
-/**
- * StructTypeInfo represents the TypeInfo of a struct. A struct contains one or
- * more fields each of which has a unique name and its own TypeInfo. Different
- * fields can have the same or different TypeInfo.
- *
- * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
- * directly creating an instance of this class.
- */
-public final class StructTypeInfo extends TypeInfo implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  private ArrayList<String> allStructFieldNames;
-  private ArrayList<TypeInfo> allStructFieldTypeInfos;
-
-  /**
-   * For java serialization use only.
-   */
-  public StructTypeInfo() {
-  }
-
-  @Override
-  public String getTypeName() {
-    StringBuilder sb = new StringBuilder();
-    sb.append(serdeConstants.STRUCT_TYPE_NAME + "<");
-    for (int i = 0; i < allStructFieldNames.size(); i++) {
-      if (i > 0) {
-        sb.append(",");
-      }
-      sb.append(allStructFieldNames.get(i));
-      sb.append(":");
-      sb.append(allStructFieldTypeInfos.get(i).getTypeName());
-    }
-    sb.append(">");
-    return sb.toString();
-  }
-
-  /**
-   * For java serialization use only.
-   */
-  public void setAllStructFieldNames(ArrayList<String> allStructFieldNames) {
-    this.allStructFieldNames = allStructFieldNames;
-  }
-
-  /**
-   * For java serialization use only.
-   */
-  public void setAllStructFieldTypeInfos(
-      ArrayList<TypeInfo> allStructFieldTypeInfos) {
-    this.allStructFieldTypeInfos = allStructFieldTypeInfos;
-  }
-
-  /**
-   * For TypeInfoFactory use only.
-   */
-  StructTypeInfo(List<String> names, List<TypeInfo> typeInfos) {
-    allStructFieldNames = new ArrayList<String>(names);
-    allStructFieldTypeInfos = new ArrayList<TypeInfo>(typeInfos);
-  }
-
-  @Override
-  public Category getCategory() {
-    return Category.STRUCT;
-  }
-
-  public ArrayList<String> getAllStructFieldNames() {
-    return allStructFieldNames;
-  }
-
-  public ArrayList<TypeInfo> getAllStructFieldTypeInfos() {
-    return allStructFieldTypeInfos;
-  }
-
-  public TypeInfo getStructFieldTypeInfo(String field) {
-    String fieldLowerCase = field.toLowerCase();
-    for (int i = 0; i < allStructFieldNames.size(); i++) {
-      if (fieldLowerCase.equals(allStructFieldNames.get(i))) {
-        return allStructFieldTypeInfos.get(i);
-      }
-    }
-    throw new RuntimeException("cannot find field " + field
-        + "(lowercase form: " + fieldLowerCase + ") in " + allStructFieldNames);
-    // return null;
-  }
-
-  @Override
-  public boolean equals(Object other) {
-    if (this == other) {
-      return true;
-    }
-    if (!(other instanceof StructTypeInfo)) {
-      return false;
-    }
-    StructTypeInfo o = (StructTypeInfo) other;
-    Iterator<String> namesIterator = getAllStructFieldNames().iterator();
-    Iterator<String> otherNamesIterator = o.getAllStructFieldNames().iterator();
-
-    // Compare the field names using ignore-case semantics
-    while (namesIterator.hasNext() && otherNamesIterator.hasNext()) {
-      if (!namesIterator.next().equalsIgnoreCase(otherNamesIterator.next())) {
-        return false;
-      }
-    }
-
-    // Different number of field names
-    if (namesIterator.hasNext() || otherNamesIterator.hasNext()) {
-      return false;
-    }
-
-    // Compare the field types
-    return o.getAllStructFieldTypeInfos().equals(getAllStructFieldTypeInfos());
-  }
-
-  @Override
-  public int hashCode() {
-    return allStructFieldNames.hashCode() ^ allStructFieldTypeInfos.hashCode();
-  }
-
-}
+/**
+ * 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.typeinfo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
+
+/**
+ * StructTypeInfo represents the TypeInfo of a struct. A struct contains one or
+ * more fields each of which has a unique name and its own TypeInfo. Different
+ * fields can have the same or different TypeInfo.
+ *
+ * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
+ * directly creating an instance of this class.
+ */
+public final class StructTypeInfo extends TypeInfo implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private ArrayList<String> allStructFieldNames;
+  private ArrayList<TypeInfo> allStructFieldTypeInfos;
+
+  /**
+   * For java serialization use only.
+   */
+  public StructTypeInfo() {
+  }
+
+  @Override
+  public String getTypeName() {
+    StringBuilder sb = new StringBuilder();
+    sb.append(serdeConstants.STRUCT_TYPE_NAME + "<");
+    for (int i = 0; i < allStructFieldNames.size(); i++) {
+      if (i > 0) {
+        sb.append(",");
+      }
+      sb.append(allStructFieldNames.get(i));
+      sb.append(":");
+      sb.append(allStructFieldTypeInfos.get(i).getTypeName());
+    }
+    sb.append(">");
+    return sb.toString();
+  }
+
+  /**
+   * For java serialization use only.
+   */
+  public void setAllStructFieldNames(ArrayList<String> allStructFieldNames) {
+    this.allStructFieldNames = allStructFieldNames;
+  }
+
+  /**
+   * For java serialization use only.
+   */
+  public void setAllStructFieldTypeInfos(
+      ArrayList<TypeInfo> allStructFieldTypeInfos) {
+    this.allStructFieldTypeInfos = allStructFieldTypeInfos;
+  }
+
+  /**
+   * For TypeInfoFactory use only.
+   */
+  StructTypeInfo(List<String> names, List<TypeInfo> typeInfos) {
+    allStructFieldNames = new ArrayList<String>(names);
+    allStructFieldTypeInfos = new ArrayList<TypeInfo>(typeInfos);
+  }
+
+  @Override
+  public Category getCategory() {
+    return Category.STRUCT;
+  }
+
+  public ArrayList<String> getAllStructFieldNames() {
+    return allStructFieldNames;
+  }
+
+  public ArrayList<TypeInfo> getAllStructFieldTypeInfos() {
+    return allStructFieldTypeInfos;
+  }
+
+  public TypeInfo getStructFieldTypeInfo(String field) {
+    String fieldLowerCase = field.toLowerCase();
+    for (int i = 0; i < allStructFieldNames.size(); i++) {
+      if (fieldLowerCase.equals(allStructFieldNames.get(i))) {
+        return allStructFieldTypeInfos.get(i);
+      }
+    }
+    throw new RuntimeException("cannot find field " + field
+        + "(lowercase form: " + fieldLowerCase + ") in " + allStructFieldNames);
+    // return null;
+  }
+
+  @Override
+  public boolean equals(Object other) {
+    if (this == other) {
+      return true;
+    }
+    if (!(other instanceof StructTypeInfo)) {
+      return false;
+    }
+    StructTypeInfo o = (StructTypeInfo) other;
+    Iterator<String> namesIterator = getAllStructFieldNames().iterator();
+    Iterator<String> otherNamesIterator = o.getAllStructFieldNames().iterator();
+
+    // Compare the field names using ignore-case semantics
+    while (namesIterator.hasNext() && otherNamesIterator.hasNext()) {
+      if (!namesIterator.next().equalsIgnoreCase(otherNamesIterator.next())) {
+        return false;
+      }
+    }
+
+    // Different number of field names
+    if (namesIterator.hasNext() || otherNamesIterator.hasNext()) {
+      return false;
+    }
+
+    // Compare the field types
+    return o.getAllStructFieldTypeInfos().equals(getAllStructFieldTypeInfos());
+  }
+
+  @Override
+  public int hashCode() {
+    return allStructFieldNames.hashCode() ^ allStructFieldTypeInfos.hashCode();
+  }
+
+}

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java Sat Jan  5 02:11:41 2013
@@ -1,62 +1,62 @@
-/**
- * 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.typeinfo;
-
-import java.io.Serializable;
-
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
-
-/**
- * Stores information about a type. Always use the TypeInfoFactory to create new
- * TypeInfo objects.
- *
- * We support 5 categories of types: 1. Primitive objects (String, Number, etc)
- * 2. List objects (a list of objects of a single type) 3. Map objects (a map
- * from objects of one type to objects of another type) 4. Struct objects (a
- * list of fields with names and their own types) 5. Union objects
- */
-public abstract class TypeInfo implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  protected TypeInfo() {
-  }
-
-  /**
-   * The Category of this TypeInfo. Possible values are Primitive, List, Map,
-   * Struct and Union, which corresponds to the 5 sub-classes of TypeInfo.
-   */
-  public abstract Category getCategory();
-
-  /**
-   * A String representation of the TypeInfo.
-   */
-  public abstract String getTypeName();
-
-  @Override
-  public String toString() {
-    return getTypeName();
-  }
-
-  @Override
-  public abstract boolean equals(Object o);
-
-  @Override
-  public abstract int hashCode();
-}
+/**
+ * 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.typeinfo;
+
+import java.io.Serializable;
+
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
+
+/**
+ * Stores information about a type. Always use the TypeInfoFactory to create new
+ * TypeInfo objects.
+ *
+ * We support 5 categories of types: 1. Primitive objects (String, Number, etc)
+ * 2. List objects (a list of objects of a single type) 3. Map objects (a map
+ * from objects of one type to objects of another type) 4. Struct objects (a
+ * list of fields with names and their own types) 5. Union objects
+ */
+public abstract class TypeInfo implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  protected TypeInfo() {
+  }
+
+  /**
+   * The Category of this TypeInfo. Possible values are Primitive, List, Map,
+   * Struct and Union, which corresponds to the 5 sub-classes of TypeInfo.
+   */
+  public abstract Category getCategory();
+
+  /**
+   * A String representation of the TypeInfo.
+   */
+  public abstract String getTypeName();
+
+  @Override
+  public String toString() {
+    return getTypeName();
+  }
+
+  @Override
+  public abstract boolean equals(Object o);
+
+  @Override
+  public abstract int hashCode();
+}

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java?rev=1429194&r1=1429193&r2=1429194&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java Sat Jan  5 02:11:41 2013
@@ -1,141 +1,141 @@
-/**
- * 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.typeinfo;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.hadoop.hive.serde.serdeConstants;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
-
-/**
- * TypeInfoFactory can be used to create the TypeInfo object for any types.
- *
- * TypeInfo objects are all read-only so we can reuse them easily.
- * TypeInfoFactory has internal cache to make sure we don't create 2 TypeInfo
- * objects that represents the same type.
- */
-public final class TypeInfoFactory {
-
-  static HashMap<String, TypeInfo> cachedPrimitiveTypeInfo = new HashMap<String, TypeInfo>();
-
-  private TypeInfoFactory() {
-    // prevent instantiation
-  }
-
-  public static TypeInfo getPrimitiveTypeInfo(String typeName) {
-    if (null == PrimitiveObjectInspectorUtils
-        .getTypeEntryFromTypeName(typeName)) {
-      throw new RuntimeException("Cannot getPrimitiveTypeInfo for " + typeName);
-    }
-    TypeInfo result = cachedPrimitiveTypeInfo.get(typeName);
-    if (result == null) {
-      result = new PrimitiveTypeInfo(typeName);
-      cachedPrimitiveTypeInfo.put(typeName, result);
-    }
-    return result;
-  }
-
-  public static final TypeInfo voidTypeInfo = getPrimitiveTypeInfo(serdeConstants.VOID_TYPE_NAME);
-  public static final TypeInfo booleanTypeInfo = getPrimitiveTypeInfo(serdeConstants.BOOLEAN_TYPE_NAME);
-  public static final TypeInfo intTypeInfo = getPrimitiveTypeInfo(serdeConstants.INT_TYPE_NAME);
-  public static final TypeInfo longTypeInfo = getPrimitiveTypeInfo(serdeConstants.BIGINT_TYPE_NAME);
-  public static final TypeInfo stringTypeInfo = getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME);
-  public static final TypeInfo floatTypeInfo = getPrimitiveTypeInfo(serdeConstants.FLOAT_TYPE_NAME);
-  public static final TypeInfo doubleTypeInfo = getPrimitiveTypeInfo(serdeConstants.DOUBLE_TYPE_NAME);
-  public static final TypeInfo byteTypeInfo = getPrimitiveTypeInfo(serdeConstants.TINYINT_TYPE_NAME);
-  public static final TypeInfo shortTypeInfo = getPrimitiveTypeInfo(serdeConstants.SMALLINT_TYPE_NAME);
-  public static final TypeInfo timestampTypeInfo = getPrimitiveTypeInfo(serdeConstants.TIMESTAMP_TYPE_NAME);
-  public static final TypeInfo binaryTypeInfo = getPrimitiveTypeInfo(serdeConstants.BINARY_TYPE_NAME);
-
-  public static final TypeInfo unknownTypeInfo = getPrimitiveTypeInfo("unknown");
-
-  public static TypeInfo getPrimitiveTypeInfoFromPrimitiveWritable(
-      Class<?> clazz) {
-    String typeName = PrimitiveObjectInspectorUtils
-        .getTypeNameFromPrimitiveWritable(clazz);
-    if (typeName == null) {
-      throw new RuntimeException("Internal error: Cannot get typeName for "
-          + clazz);
-    }
-    return getPrimitiveTypeInfo(typeName);
-  }
-
-  public static TypeInfo getPrimitiveTypeInfoFromJavaPrimitive(Class<?> clazz) {
-    return getPrimitiveTypeInfo(PrimitiveObjectInspectorUtils
-        .getTypeNameFromPrimitiveJava(clazz));
-  }
-
-  static HashMap<ArrayList<List<?>>, TypeInfo> cachedStructTypeInfo =
-    new HashMap<ArrayList<List<?>>, TypeInfo>();
-
-  public static TypeInfo getStructTypeInfo(List<String> names,
-      List<TypeInfo> typeInfos) {
-    ArrayList<List<?>> signature = new ArrayList<List<?>>(2);
-    signature.add(names);
-    signature.add(typeInfos);
-    TypeInfo result = cachedStructTypeInfo.get(signature);
-    if (result == null) {
-      result = new StructTypeInfo(names, typeInfos);
-      cachedStructTypeInfo.put(signature, result);
-    }
-    return result;
-  }
-
-  static HashMap<List<?>, TypeInfo> cachedUnionTypeInfo =
-    new HashMap<List<?>, TypeInfo>();
-
-  public static TypeInfo getUnionTypeInfo(List<TypeInfo> typeInfos) {
-    TypeInfo result = cachedUnionTypeInfo.get(typeInfos);
-    if (result == null) {
-      result = new UnionTypeInfo(typeInfos);
-      cachedUnionTypeInfo.put(typeInfos, result);
-    }
-    return result;
-  }
-
-  static HashMap<TypeInfo, TypeInfo> cachedListTypeInfo = new HashMap<TypeInfo, TypeInfo>();
-
-  public static TypeInfo getListTypeInfo(TypeInfo elementTypeInfo) {
-    TypeInfo result = cachedListTypeInfo.get(elementTypeInfo);
-    if (result == null) {
-      result = new ListTypeInfo(elementTypeInfo);
-      cachedListTypeInfo.put(elementTypeInfo, result);
-    }
-    return result;
-  }
-
-  static HashMap<ArrayList<TypeInfo>, TypeInfo> cachedMapTypeInfo =
-    new HashMap<ArrayList<TypeInfo>, TypeInfo>();
-
-  public static TypeInfo getMapTypeInfo(TypeInfo keyTypeInfo,
-      TypeInfo valueTypeInfo) {
-    ArrayList<TypeInfo> signature = new ArrayList<TypeInfo>(2);
-    signature.add(keyTypeInfo);
-    signature.add(valueTypeInfo);
-    TypeInfo result = cachedMapTypeInfo.get(signature);
-    if (result == null) {
-      result = new MapTypeInfo(keyTypeInfo, valueTypeInfo);
-      cachedMapTypeInfo.put(signature, result);
-    }
-    return result;
-  };
-
-}
+/**
+ * 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.typeinfo;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
+
+/**
+ * TypeInfoFactory can be used to create the TypeInfo object for any types.
+ *
+ * TypeInfo objects are all read-only so we can reuse them easily.
+ * TypeInfoFactory has internal cache to make sure we don't create 2 TypeInfo
+ * objects that represents the same type.
+ */
+public final class TypeInfoFactory {
+
+  static HashMap<String, TypeInfo> cachedPrimitiveTypeInfo = new HashMap<String, TypeInfo>();
+
+  private TypeInfoFactory() {
+    // prevent instantiation
+  }
+
+  public static TypeInfo getPrimitiveTypeInfo(String typeName) {
+    if (null == PrimitiveObjectInspectorUtils
+        .getTypeEntryFromTypeName(typeName)) {
+      throw new RuntimeException("Cannot getPrimitiveTypeInfo for " + typeName);
+    }
+    TypeInfo result = cachedPrimitiveTypeInfo.get(typeName);
+    if (result == null) {
+      result = new PrimitiveTypeInfo(typeName);
+      cachedPrimitiveTypeInfo.put(typeName, result);
+    }
+    return result;
+  }
+
+  public static final TypeInfo voidTypeInfo = getPrimitiveTypeInfo(serdeConstants.VOID_TYPE_NAME);
+  public static final TypeInfo booleanTypeInfo = getPrimitiveTypeInfo(serdeConstants.BOOLEAN_TYPE_NAME);
+  public static final TypeInfo intTypeInfo = getPrimitiveTypeInfo(serdeConstants.INT_TYPE_NAME);
+  public static final TypeInfo longTypeInfo = getPrimitiveTypeInfo(serdeConstants.BIGINT_TYPE_NAME);
+  public static final TypeInfo stringTypeInfo = getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME);
+  public static final TypeInfo floatTypeInfo = getPrimitiveTypeInfo(serdeConstants.FLOAT_TYPE_NAME);
+  public static final TypeInfo doubleTypeInfo = getPrimitiveTypeInfo(serdeConstants.DOUBLE_TYPE_NAME);
+  public static final TypeInfo byteTypeInfo = getPrimitiveTypeInfo(serdeConstants.TINYINT_TYPE_NAME);
+  public static final TypeInfo shortTypeInfo = getPrimitiveTypeInfo(serdeConstants.SMALLINT_TYPE_NAME);
+  public static final TypeInfo timestampTypeInfo = getPrimitiveTypeInfo(serdeConstants.TIMESTAMP_TYPE_NAME);
+  public static final TypeInfo binaryTypeInfo = getPrimitiveTypeInfo(serdeConstants.BINARY_TYPE_NAME);
+
+  public static final TypeInfo unknownTypeInfo = getPrimitiveTypeInfo("unknown");
+
+  public static TypeInfo getPrimitiveTypeInfoFromPrimitiveWritable(
+      Class<?> clazz) {
+    String typeName = PrimitiveObjectInspectorUtils
+        .getTypeNameFromPrimitiveWritable(clazz);
+    if (typeName == null) {
+      throw new RuntimeException("Internal error: Cannot get typeName for "
+          + clazz);
+    }
+    return getPrimitiveTypeInfo(typeName);
+  }
+
+  public static TypeInfo getPrimitiveTypeInfoFromJavaPrimitive(Class<?> clazz) {
+    return getPrimitiveTypeInfo(PrimitiveObjectInspectorUtils
+        .getTypeNameFromPrimitiveJava(clazz));
+  }
+
+  static HashMap<ArrayList<List<?>>, TypeInfo> cachedStructTypeInfo =
+    new HashMap<ArrayList<List<?>>, TypeInfo>();
+
+  public static TypeInfo getStructTypeInfo(List<String> names,
+      List<TypeInfo> typeInfos) {
+    ArrayList<List<?>> signature = new ArrayList<List<?>>(2);
+    signature.add(names);
+    signature.add(typeInfos);
+    TypeInfo result = cachedStructTypeInfo.get(signature);
+    if (result == null) {
+      result = new StructTypeInfo(names, typeInfos);
+      cachedStructTypeInfo.put(signature, result);
+    }
+    return result;
+  }
+
+  static HashMap<List<?>, TypeInfo> cachedUnionTypeInfo =
+    new HashMap<List<?>, TypeInfo>();
+
+  public static TypeInfo getUnionTypeInfo(List<TypeInfo> typeInfos) {
+    TypeInfo result = cachedUnionTypeInfo.get(typeInfos);
+    if (result == null) {
+      result = new UnionTypeInfo(typeInfos);
+      cachedUnionTypeInfo.put(typeInfos, result);
+    }
+    return result;
+  }
+
+  static HashMap<TypeInfo, TypeInfo> cachedListTypeInfo = new HashMap<TypeInfo, TypeInfo>();
+
+  public static TypeInfo getListTypeInfo(TypeInfo elementTypeInfo) {
+    TypeInfo result = cachedListTypeInfo.get(elementTypeInfo);
+    if (result == null) {
+      result = new ListTypeInfo(elementTypeInfo);
+      cachedListTypeInfo.put(elementTypeInfo, result);
+    }
+    return result;
+  }
+
+  static HashMap<ArrayList<TypeInfo>, TypeInfo> cachedMapTypeInfo =
+    new HashMap<ArrayList<TypeInfo>, TypeInfo>();
+
+  public static TypeInfo getMapTypeInfo(TypeInfo keyTypeInfo,
+      TypeInfo valueTypeInfo) {
+    ArrayList<TypeInfo> signature = new ArrayList<TypeInfo>(2);
+    signature.add(keyTypeInfo);
+    signature.add(valueTypeInfo);
+    TypeInfo result = cachedMapTypeInfo.get(signature);
+    if (result == null) {
+      result = new MapTypeInfo(keyTypeInfo, valueTypeInfo);
+      cachedMapTypeInfo.put(signature, result);
+    }
+    return result;
+  };
+
+}



Mime
View raw message