hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From athu...@apache.org
Subject svn commit: r958148 - in /hadoop/hive/branches/branch-0.6: ./ serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/
Date Fri, 25 Jun 2010 23:27:10 GMT
Author: athusoo
Date: Fri Jun 25 23:27:10 2010
New Revision: 958148

URL: http://svn.apache.org/viewvc?rev=958148&view=rev
Log:
HIVE-1271. Make matching of type information case insensitive. 
(Arvind Prabhakar via Ashish Thusoo)


Added:
    hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/package-info.java
Modified:
    hadoop/hive/branches/branch-0.6/CHANGES.txt
    hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java
    hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java
    hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
    hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java
    hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java

Modified: hadoop/hive/branches/branch-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.6/CHANGES.txt?rev=958148&r1=958147&r2=958148&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.6/CHANGES.txt (original)
+++ hadoop/hive/branches/branch-0.6/CHANGES.txt Fri Jun 25 23:27:10 2010
@@ -540,6 +540,9 @@ Release 0.6.0 -  Unreleased
 
     HIVE-1417. Archived partitions throw error with queries calling
     getContentSummary (Paul Yang via namit)
+  
+    HIVE-1271. Make matching of type information case insensitive. 
+    (Arvind Prabhakar via Ashish Thusoo)
 
     HIVE-1176. 'create if not exists' fails for a table name with
     'select' in it.

Modified: hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java?rev=958148&r1=958147&r2=958148&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java
(original)
+++ hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/ListTypeInfo.java
Fri Jun 25 23:27:10 2010
@@ -29,10 +29,10 @@ import org.apache.hadoop.hive.serde2.obj
  * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
  * directly creating an instance of this class.
  */
-public class ListTypeInfo extends TypeInfo implements Serializable {
+public final class ListTypeInfo extends TypeInfo implements Serializable {
 
   private static final long serialVersionUID = 1L;
-  TypeInfo listElementTypeInfo;
+  private TypeInfo listElementTypeInfo;
 
   /**
    * For java serialization use only.
@@ -77,9 +77,8 @@ public class ListTypeInfo extends TypeIn
     if (!(other instanceof ListTypeInfo)) {
       return false;
     }
-    ListTypeInfo o = (ListTypeInfo) other;
-    return o.getCategory().equals(getCategory())
-        && o.getListElementTypeInfo().equals(getListElementTypeInfo());
+    return getListElementTypeInfo().equals(
+        ((ListTypeInfo) other).getListElementTypeInfo());
   }
 
   @Override

Modified: hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java?rev=958148&r1=958147&r2=958148&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java
(original)
+++ hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/MapTypeInfo.java
Fri Jun 25 23:27:10 2010
@@ -31,12 +31,12 @@ import org.apache.hadoop.hive.serde2.obj
  * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
  * directly creating an instance of this class.
  */
-public class MapTypeInfo extends TypeInfo implements Serializable {
+public final class MapTypeInfo extends TypeInfo implements Serializable {
 
   private static final long serialVersionUID = 1L;
 
-  TypeInfo mapKeyTypeInfo;
-  TypeInfo mapValueTypeInfo;
+  private TypeInfo mapKeyTypeInfo;
+  private TypeInfo mapValueTypeInfo;
 
   /**
    * For java serialization use only.
@@ -93,8 +93,7 @@ public class MapTypeInfo extends TypeInf
       return false;
     }
     MapTypeInfo o = (MapTypeInfo) other;
-    return o.getCategory().equals(getCategory())
-        && o.getMapKeyTypeInfo().equals(getMapKeyTypeInfo())
+    return o.getMapKeyTypeInfo().equals(getMapKeyTypeInfo())
         && o.getMapValueTypeInfo().equals(getMapValueTypeInfo());
   }
 

Modified: hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java?rev=958148&r1=958147&r2=958148&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
(original)
+++ hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
Fri Jun 25 23:27:10 2010
@@ -31,11 +31,11 @@ import org.apache.hadoop.hive.serde2.obj
  * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
  * directly creating an instance of this class.
  */
-public class PrimitiveTypeInfo extends TypeInfo implements Serializable {
+public final class PrimitiveTypeInfo extends TypeInfo implements Serializable {
 
   private static final long serialVersionUID = 1L;
 
-  String typeName;
+  private String typeName;
 
   /**
    * For java serialization use only.

Modified: hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java?rev=958148&r1=958147&r2=958148&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java
(original)
+++ hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/StructTypeInfo.java
Fri Jun 25 23:27:10 2010
@@ -20,6 +20,7 @@ package org.apache.hadoop.hive.serde2.ty
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.hadoop.hive.serde.Constants;
@@ -33,12 +34,12 @@ import org.apache.hadoop.hive.serde2.obj
  * Always use the TypeInfoFactory to create new TypeInfo objects, instead of
  * directly creating an instance of this class.
  */
-public class StructTypeInfo extends TypeInfo implements Serializable {
+public final class StructTypeInfo extends TypeInfo implements Serializable {
 
   private static final long serialVersionUID = 1L;
 
-  ArrayList<String> allStructFieldNames;
-  ArrayList<TypeInfo> allStructFieldTypeInfos;
+  private ArrayList<String> allStructFieldNames;
+  private ArrayList<TypeInfo> allStructFieldTypeInfos;
 
   /**
    * For java serialization use only.
@@ -121,9 +122,23 @@ public class StructTypeInfo extends Type
       return false;
     }
     StructTypeInfo o = (StructTypeInfo) other;
-    return o.getCategory().equals(getCategory())
-        && o.getAllStructFieldNames().equals(getAllStructFieldNames())
-        && o.getAllStructFieldTypeInfos().equals(getAllStructFieldTypeInfos());
+    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

Modified: hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java?rev=958148&r1=958147&r2=958148&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java
(original)
+++ hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java
Fri Jun 25 23:27:10 2010
@@ -33,6 +33,8 @@ import org.apache.hadoop.hive.serde2.obj
  */
 public abstract class TypeInfo implements Serializable {
 
+  private static final long serialVersionUID = 1L;
+
   protected TypeInfo() {
   }
 
@@ -53,17 +55,8 @@ public abstract class TypeInfo implement
   }
 
   @Override
-  public boolean equals(Object o) {
-    if (!(o instanceof TypeInfo)) {
-      return false;
-    }
-    TypeInfo dest = (TypeInfo) o;
-    if (getCategory() != dest.getCategory()) {
-      return false;
-    }
-    if (getTypeName() != dest.getTypeName()) {
-      return false;
-    }
-    return true;
-  }
+  public abstract boolean equals(Object o);
+
+  @Override
+  public abstract int hashCode();
 }

Added: hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/package-info.java
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/package-info.java?rev=958148&view=auto
==============================================================================
--- hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/package-info.java
(added)
+++ hadoop/hive/branches/branch-0.6/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/package-info.java
Fri Jun 25 23:27:10 2010
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+
+/**
+ * This package provides the implementation of the SerDe type system.
+ */
+package org.apache.hadoop.hive.serde2.typeinfo;



Mime
View raw message