hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zs...@apache.org
Subject svn commit: r697291 [31/31] - in /hadoop/core/trunk: ./ src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/ src/contrib/hive/metastore/if/ src/contrib/hive/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ src/contrib/hive/metastor...
Date Fri, 19 Sep 2008 23:56:35 GMT
Modified: hadoop/core/trunk/src/contrib/hive/serde/src/gen-php/serde_constants.php
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/gen-php/serde_constants.php?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/gen-php/serde_constants.php (original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/gen-php/serde_constants.php Fri Sep 19 16:56:30
2008
@@ -16,4 +16,51 @@
 
 $GLOBALS['serde_CONSTANTS']['SERIALIZATION_DDL'] = 'serialization.ddl';
 
+$GLOBALS['serde_CONSTANTS']['FIELD_DELIM'] = 'field.delim';
+
+$GLOBALS['serde_CONSTANTS']['COLLECTION_DELIM'] = 'colelction.delim';
+
+$GLOBALS['serde_CONSTANTS']['LINE_DELIM'] = 'line.delim';
+
+$GLOBALS['serde_CONSTANTS']['MAPKEY_DELIM'] = 'mapkey.delim';
+
+$GLOBALS['serde_CONSTANTS']['TINYINT_TYPE_NAME'] = 'tinyint';
+
+$GLOBALS['serde_CONSTANTS']['INT_TYPE_NAME'] = 'int';
+
+$GLOBALS['serde_CONSTANTS']['BIGINT_TYPE_NAME'] = 'bigint';
+
+$GLOBALS['serde_CONSTANTS']['FLOAT_TYPE_NAME'] = 'float';
+
+$GLOBALS['serde_CONSTANTS']['DOUBLE_TYPE_NAME'] = 'double';
+
+$GLOBALS['serde_CONSTANTS']['STRING_TYPE_NAME'] = 'string';
+
+$GLOBALS['serde_CONSTANTS']['DATE_TYPE_NAME'] = 'date';
+
+$GLOBALS['serde_CONSTANTS']['DATETIME_TYPE_NAME'] = 'datetime';
+
+$GLOBALS['serde_CONSTANTS']['TIMESTAMP_TYPE_NAME'] = 'timestamp';
+
+$GLOBALS['serde_CONSTANTS']['LIST_TYPE_NAME'] = 'array';
+
+$GLOBALS['serde_CONSTANTS']['MAP_TYPE_NAME'] = 'map';
+
+$GLOBALS['serde_CONSTANTS']['PrimitiveTypes'] = array(
+  'tinyint' => true,
+  'int' => true,
+  'bigint' => true,
+  'float' => true,
+  'double' => true,
+  'string' => true,
+  'date' => true,
+  'datetime' => true,
+  'timestamp' => true,
+);
+
+$GLOBALS['serde_CONSTANTS']['CollectionTypes'] = array(
+  'array' => true,
+  'map' => true,
+);
+
 ?>

Modified: hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/MetadataTypedColumnsetSerDe.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/MetadataTypedColumnsetSerDe.java?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/MetadataTypedColumnsetSerDe.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/MetadataTypedColumnsetSerDe.java
Fri Sep 19 16:56:30 2008
@@ -104,7 +104,7 @@
       columnNames = Arrays.asList(columnProperty.split(","));
       cachedObjectInspector = MetadataListStructObjectInspector.getInstance(columnNames);
     }
-    System.out.println(getClass().getName() + ": initialized with columnNames: " + columnNames
);
+    LOG.info(getClass().getName() + ": initialized with columnNames: " + columnNames );
   }
 
   public static Object deserialize(ColumnSet c, String row, String sep, String nullString)
throws Exception {

Modified: hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java
Fri Sep 19 16:56:30 2008
@@ -23,6 +23,9 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 /**
  * ObjectInspectorFactory is the primary way to create new ObjectInspector instances.
  * 
@@ -31,6 +34,8 @@
  */
 public class ObjectInspectorUtils {
 
+  private static Log LOG = LogFactory.getLog(ObjectInspectorUtils.class.getName());
+  
   /** This function defines the list of PrimitiveClasses that we support. 
    *  A PrimitiveClass should support java serialization/deserialization.
    */
@@ -58,7 +63,37 @@
     return primitiveClass;
   }
   
-
+  /**
+   * Get the short name for the types
+   */
+  public static String getClassShortName(String className) {
+    String result = className;
+    
+    if (result.equals(String.class.getName())) {
+      result = org.apache.hadoop.hive.serde.Constants.STRING_TYPE_NAME;
+    } else if (result.equals(Integer.class.getName())) {
+      result = org.apache.hadoop.hive.serde.Constants.INT_TYPE_NAME;
+    } else if (result.equals(Float.class.getName())) {
+      result = org.apache.hadoop.hive.serde.Constants.FLOAT_TYPE_NAME;
+    } else if (result.equals(Double.class.getName())) {
+      result = org.apache.hadoop.hive.serde.Constants.DOUBLE_TYPE_NAME;
+    } else if (result.equals(Long.class.getName())) {
+      result = org.apache.hadoop.hive.serde.Constants.BIGINT_TYPE_NAME;
+    } else if (result.equals(java.sql.Date.class.getName())) {
+      result = org.apache.hadoop.hive.serde.Constants.DATE_TYPE_NAME;
+    } else {
+      LOG.warn("unsupported class: " + className);
+    }
+    
+    // Remove prefix
+    String prefix = "java.lang.";
+    if (result.startsWith(prefix)) {
+      result = result.substring(prefix.length());
+    }
+    
+    return result;
+  }
+  
   static ArrayList<ArrayList<String>> integerArrayCache = new ArrayList<ArrayList<String>>();
   /**
    * Returns an array of Integer strings, starting from "0".

Modified: hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java
Fri Sep 19 16:56:30 2008
@@ -69,7 +69,10 @@
   }
   
   /**
-   * This method is only intended to be used by Utilities class in this package.
+   * This method is only intended to be used by the Utilities class in this package.
+   * This creates an uninitialized ObjectInspector so the Utilities class can put it into
+   * a cache before it initializes when it might look up the cache for member fields that
+   * might be of the same type (e.g. recursive type like linked list and trees).
    */
   ReflectionStructObjectInspector() {
   }

Modified: hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardListObjectInspector.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardListObjectInspector.java?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardListObjectInspector.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardListObjectInspector.java
Fri Sep 19 16:56:30 2008
@@ -71,7 +71,8 @@
   }
 
   public String getTypeName() {
-    return "list<" + listElementObjectInspector.getTypeName() + ">";
+    return org.apache.hadoop.hive.serde.Constants.LIST_TYPE_NAME 
+        + "<" + listElementObjectInspector.getTypeName() + ">";
   }
 
 }

Modified: hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardMapObjectInspector.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardMapObjectInspector.java?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardMapObjectInspector.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardMapObjectInspector.java
Fri Sep 19 16:56:30 2008
@@ -75,7 +75,8 @@
   }
 
   public String getTypeName() {
-    return "map<" + mapKeyObjectInspector.getTypeName() + "," 
+    return org.apache.hadoop.hive.serde.Constants.MAP_TYPE_NAME 
+        + "<" + mapKeyObjectInspector.getTypeName() + "," 
         + mapValueObjectInspector.getTypeName() + ">";
   }
 

Modified: hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardPrimitiveObjectInspector.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardPrimitiveObjectInspector.java?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardPrimitiveObjectInspector.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/StandardPrimitiveObjectInspector.java
Fri Sep 19 16:56:30 2008
@@ -43,7 +43,7 @@
   }
 
   public String getTypeName() {
-    return primitiveClass.getName();
+    return ObjectInspectorUtils.getClassShortName(primitiveClass.getName());
   }
 
 }

Modified: hadoop/core/trunk/src/contrib/hive/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestStandardObjectInspectors.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestStandardObjectInspectors.java?rev=697291&r1=697290&r2=697291&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestStandardObjectInspectors.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/TestStandardObjectInspectors.java
Fri Sep 19 16:56:30 2008
@@ -34,7 +34,8 @@
       assertEquals(oi1, oi2);
       assertEquals(Category.PRIMITIVE, oi1.getCategory());
       assertEquals(c, oi1.getPrimitiveClass());
-      assertEquals(c.getName(), oi1.getTypeName()); 
+      assertEquals(ObjectInspectorUtils.getClassShortName(c.getName()),
+          oi1.getTypeName()); 
     } catch (Throwable e) {
       e.printStackTrace();
       throw e;



Mime
View raw message