You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2010/10/19 07:17:04 UTC

svn commit: r1024116 [1/6] - in /hadoop/hive/trunk: ./ ql/src/java/org/apache/hadoop/hive/ql/exec/ ql/src/java/org/apache/hadoop/hive/ql/udf/ ql/src/java/org/apache/hadoop/hive/ql/udf/generic/ ql/src/test/results/clientpositive/ ql/src/test/results/com...

Author: namit
Date: Tue Oct 19 05:17:02 2010
New Revision: 1024116

URL: http://svn.apache.org/viewvc?rev=1024116&view=rev
Log:
HIVE-1638. convert commonly used udfs to generic udfs
(Siyong Dong via namit)


Added:
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseCompare.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPAnd.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNot.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPOr.java
Removed:
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPAnd.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPEqual.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPEqualOrGreaterThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPEqualOrLessThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPGreaterThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPLessThan.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPNot.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPNotEqual.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFOPOr.java
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
    hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_greaterthanorequal.q.out
    hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_lessthanorequal.q.out
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/case_sensitivity.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/cast1.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/input1.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/input2.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/input3.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/input4.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/input9.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/input_part1.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/input_testxpath2.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/join4.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/join5.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/join6.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/join7.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/join8.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/sample1.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/sample2.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/sample3.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/sample4.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/sample5.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/sample6.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/sample7.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/subq.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/udf1.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/udf_when.q.xml
    hadoop/hive/trunk/ql/src/test/results/compiler/plan/union.q.xml

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=1024116&r1=1024115&r2=1024116&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Tue Oct 19 05:17:02 2010
@@ -193,6 +193,9 @@ Trunk -  Unreleased
     HIVE-1704. remove Hadoop 0.17 specific test reference logs
     (jvs via Ning Zhang)
 
+    HIVE-1638. convert commonly used udfs to generic udfs
+    (Siyong Dong via namit)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java?rev=1024116&r1=1024115&r2=1024116&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java Tue Oct 19 05:17:02 2010
@@ -73,25 +73,16 @@ import org.apache.hadoop.hive.ql.udf.UDF
 import org.apache.hadoop.hive.ql.udf.UDFLpad;
 import org.apache.hadoop.hive.ql.udf.UDFMinute;
 import org.apache.hadoop.hive.ql.udf.UDFMonth;
-import org.apache.hadoop.hive.ql.udf.UDFOPAnd;
 import org.apache.hadoop.hive.ql.udf.UDFOPBitAnd;
 import org.apache.hadoop.hive.ql.udf.UDFOPBitNot;
 import org.apache.hadoop.hive.ql.udf.UDFOPBitOr;
 import org.apache.hadoop.hive.ql.udf.UDFOPBitXor;
 import org.apache.hadoop.hive.ql.udf.UDFOPDivide;
-import org.apache.hadoop.hive.ql.udf.UDFOPEqual;
-import org.apache.hadoop.hive.ql.udf.UDFOPEqualOrGreaterThan;
-import org.apache.hadoop.hive.ql.udf.UDFOPEqualOrLessThan;
-import org.apache.hadoop.hive.ql.udf.UDFOPGreaterThan;
-import org.apache.hadoop.hive.ql.udf.UDFOPLessThan;
 import org.apache.hadoop.hive.ql.udf.UDFOPLongDivide;
 import org.apache.hadoop.hive.ql.udf.UDFOPMinus;
 import org.apache.hadoop.hive.ql.udf.UDFOPMod;
 import org.apache.hadoop.hive.ql.udf.UDFOPMultiply;
 import org.apache.hadoop.hive.ql.udf.UDFOPNegative;
-import org.apache.hadoop.hive.ql.udf.UDFOPNot;
-import org.apache.hadoop.hive.ql.udf.UDFOPNotEqual;
-import org.apache.hadoop.hive.ql.udf.UDFOPOr;
 import org.apache.hadoop.hive.ql.udf.UDFOPPlus;
 import org.apache.hadoop.hive.ql.udf.UDFOPPositive;
 import org.apache.hadoop.hive.ql.udf.UDFPI;
@@ -168,8 +159,17 @@ import org.apache.hadoop.hive.ql.udf.gen
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFInstr;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFLocate;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFMap;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNot;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotEqual;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotNull;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNull;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPOr;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFReflect;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSentences;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSize;
@@ -319,25 +319,24 @@ public final class FunctionRegistry {
     registerUDF("^", UDFOPBitXor.class, true);
     registerUDF("~", UDFOPBitNot.class, true);
 
-    registerUDF("=", UDFOPEqual.class, true);
-    registerUDF("==", UDFOPEqual.class, true, "=");
-    registerUDF("<>", UDFOPNotEqual.class, true);
-    registerUDF("!=", UDFOPNotEqual.class, true, "<>");
-    registerUDF("<", UDFOPLessThan.class, true);
-    registerUDF("<=", UDFOPEqualOrLessThan.class, true);
-    registerUDF(">", UDFOPGreaterThan.class, true);
-    registerUDF(">=", UDFOPEqualOrGreaterThan.class, true);
-
-    registerUDF("and", UDFOPAnd.class, true);
-    registerUDF("or", UDFOPOr.class, true);
-    registerUDF("not", UDFOPNot.class, true);
-    registerUDF("!", UDFOPNot.class, true, "not");
-
     registerGenericUDF("isnull", GenericUDFOPNull.class);
     registerGenericUDF("isnotnull", GenericUDFOPNotNull.class);
 
     registerGenericUDF("if", GenericUDFIf.class);
     registerGenericUDF("in", GenericUDFIn.class);
+    registerGenericUDF("and", GenericUDFOPAnd.class);
+    registerGenericUDF("or", GenericUDFOPOr.class);
+    registerGenericUDF("=", GenericUDFOPEqual.class);
+    registerGenericUDF("==", GenericUDFOPEqual.class);
+    registerGenericUDF("!=", GenericUDFOPNotEqual.class);
+    registerGenericUDF("<>", GenericUDFOPNotEqual.class);
+    registerGenericUDF("<", GenericUDFOPLessThan.class);
+    registerGenericUDF("<=", GenericUDFOPEqualOrLessThan.class);
+    registerGenericUDF(">", GenericUDFOPGreaterThan.class);
+    registerGenericUDF(">=", GenericUDFOPEqualOrGreaterThan.class);
+    registerGenericUDF("not", GenericUDFOPNot.class);
+    registerGenericUDF("!", GenericUDFOPNot.class);
+
 
     // Aliases for Java Class Names
     // These are used in getImplicitConvertUDFMethod
@@ -388,7 +387,7 @@ public final class FunctionRegistry {
 
     // Generic UDFs
     registerGenericUDF("reflect", GenericUDFReflect.class);
-    
+
     registerGenericUDF("array", GenericUDFArray.class);
     registerGenericUDF("map", GenericUDFMap.class);
     registerGenericUDF("struct", GenericUDFStruct.class);
@@ -975,6 +974,18 @@ public final class FunctionRegistry {
    * Get the UDF class from an exprNodeDesc. Returns null if the exprNodeDesc
    * does not contain a UDF class.
    */
+  private static Class<? extends GenericUDF> getGenericUDFClassFromExprDesc(ExprNodeDesc desc) {
+    if (!(desc instanceof ExprNodeGenericFuncDesc)) {
+      return null;
+    }
+    ExprNodeGenericFuncDesc genericFuncDesc = (ExprNodeGenericFuncDesc) desc;
+    return genericFuncDesc.getGenericUDF().getClass();
+  }
+
+  /**
+   * Get the UDF class from an exprNodeDesc. Returns null if the exprNodeDesc
+   * does not contain a UDF class.
+   */
   private static Class<? extends UDF> getUDFClassFromExprDesc(ExprNodeDesc desc) {
     if (!(desc instanceof ExprNodeGenericFuncDesc)) {
       return null;
@@ -1012,17 +1023,17 @@ public final class FunctionRegistry {
    * Returns whether the exprNodeDesc is a node of "and", "or", "not".
    */
   public static boolean isOpAndOrNot(ExprNodeDesc desc) {
-    Class<? extends UDF> udfClass = getUDFClassFromExprDesc(desc);
-    return UDFOPAnd.class == udfClass || UDFOPOr.class == udfClass
-        || UDFOPNot.class == udfClass;
+    Class<? extends GenericUDF> genericUdfClass = getGenericUDFClassFromExprDesc(desc);
+    return GenericUDFOPAnd.class == genericUdfClass
+        || GenericUDFOPOr.class == genericUdfClass
+        || GenericUDFOPNot.class == genericUdfClass;
   }
 
   /**
    * Returns whether the exprNodeDesc is a node of "and".
    */
   public static boolean isOpAnd(ExprNodeDesc desc) {
-    Class<? extends UDF> udfClass = getUDFClassFromExprDesc(desc);
-    return UDFOPAnd.class == udfClass;
+    return GenericUDFOPAnd.class == getGenericUDFClassFromExprDesc(desc);
   }
 
   /**

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseCompare.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseCompare.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseCompare.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseCompare.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,154 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFUtils.ReturnObjectInspectorResolver;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.Converter;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.BooleanObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.ByteObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.IntObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.LongObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
+import org.apache.hadoop.io.BooleanWritable;
+
+/**
+ * GenericUDF Base Class for operations.
+ */
+@Description(name = "op", value = "a op b - Returns the result of operation")
+public abstract class GenericUDFBaseCompare extends GenericUDF {
+  public enum CompareType {
+    // Now only string, int and bollean comparisons are treated as special cases.
+    // For other types, we reuse ObjectInspectorUtils.compare()
+    COMPARE_STRING, COMPARE_TEXT, COMPARE_INT, COMPARE_LONG, COMPARE_BYTE,
+    COMPARE_BOOL, SAME_TYPE, NEED_CONVERT
+  }
+
+  protected String opName;
+  protected String opDisplayName;
+
+  protected ObjectInspector[] argumentOIs;
+
+  protected ReturnObjectInspectorResolver conversionHelper = null;
+  protected ObjectInspector compareOI;
+  protected CompareType compareType;
+  protected Converter converter0, converter1;
+  protected StringObjectInspector soi0, soi1;
+  protected IntObjectInspector ioi0, ioi1;
+  protected LongObjectInspector loi0, loi1;
+  protected ByteObjectInspector byoi0, byoi1;
+  protected BooleanObjectInspector boi0,boi1;
+  protected final BooleanWritable result = new BooleanWritable();
+
+  @Override
+  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
+
+    if (arguments.length != 2) {
+      throw new UDFArgumentException(
+          opName + " requires two arguments.");
+    }
+
+    argumentOIs = arguments;
+
+    for (int i = 0; i < arguments.length; i++) {
+      Category category = arguments[i].getCategory();
+      if (category != Category.PRIMITIVE) {
+        throw new UDFArgumentTypeException(i, "The "
+            + GenericUDFUtils.getOrdinal(i + 1)
+            + " argument of " + opName + "  is expected to a "
+            + Category.PRIMITIVE.toString().toLowerCase() + " type, but "
+            + category.toString().toLowerCase() + " is found");
+      }
+    }
+
+    if (TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[0]) ==
+      TypeInfoFactory.stringTypeInfo &&
+      TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[1]) ==
+        TypeInfoFactory.stringTypeInfo) {
+      soi0 = (StringObjectInspector) arguments[0];
+      soi1 = (StringObjectInspector) arguments[1];
+      if (soi0.preferWritable() || soi1.preferWritable()) {
+        compareType = CompareType.COMPARE_TEXT;
+      } else {
+        compareType = CompareType.COMPARE_STRING;
+      }
+    } else if (TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[0]).equals(
+      TypeInfoFactory.intTypeInfo) &&
+      TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[1]).equals(
+        TypeInfoFactory.intTypeInfo)) {
+      compareType = CompareType.COMPARE_INT;
+      ioi0 = (IntObjectInspector) arguments[0];
+      ioi1 = (IntObjectInspector) arguments[1];
+    } else if (TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[0]).equals(
+        TypeInfoFactory.longTypeInfo) &&
+        TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[1]).equals(
+          TypeInfoFactory.longTypeInfo)) {
+        compareType = CompareType.COMPARE_LONG;
+        loi0 = (LongObjectInspector) arguments[0];
+        loi1 = (LongObjectInspector) arguments[1];
+    } else if (TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[0]).equals(
+        TypeInfoFactory.byteTypeInfo) &&
+        TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[1]).equals(
+          TypeInfoFactory.byteTypeInfo)) {
+        compareType = CompareType.COMPARE_BYTE;
+        byoi0 = (ByteObjectInspector) arguments[0];
+        byoi1 = (ByteObjectInspector) arguments[1];
+    } else if (TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[0]).equals(
+        TypeInfoFactory.booleanTypeInfo) &&
+        TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[1]).equals(
+          TypeInfoFactory.booleanTypeInfo)) {
+      compareType = CompareType.COMPARE_BOOL;
+      boi0 = (BooleanObjectInspector) arguments[0];
+      boi1 = (BooleanObjectInspector) arguments[1];
+     } else {
+      TypeInfo oiTypeInfo0 = TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[0]);
+      TypeInfo oiTypeInfo1 = TypeInfoUtils.getTypeInfoFromObjectInspector(arguments[1]);
+
+      if (oiTypeInfo0 != oiTypeInfo1) {
+        compareType = CompareType.NEED_CONVERT;
+        compareOI = TypeInfoUtils.getStandardWritableObjectInspectorFromTypeInfo(
+            TypeInfoFactory.doubleTypeInfo);
+        converter0 = ObjectInspectorConverters.getConverter(arguments[0], compareOI);
+        converter1 = ObjectInspectorConverters.getConverter(arguments[1], compareOI);
+      } else {
+        compareType = CompareType.SAME_TYPE;
+      }
+    }
+    return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
+
+  }
+
+
+  @Override
+  public String getDisplayString(String[] children) {
+    assert (children.length == 2);
+    return "(" + children[0] + " " + opDisplayName + " " + children[1] + ")";
+
+  }
+
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPAnd.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPAnd.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPAnd.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPAnd.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,84 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.BooleanObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.io.BooleanWritable;
+
+/**
+ * GenericUDF Class for computing and.
+ */
+@Description(name = "and", value = "a _FUNC_ b - Logical and")
+public class GenericUDFOPAnd extends GenericUDF {
+  private final BooleanWritable result = new BooleanWritable();
+  BooleanObjectInspector boi0,boi1;
+  @Override
+  public ObjectInspector initialize(ObjectInspector[] arguments)
+      throws UDFArgumentException {
+    if (arguments.length != 2) {
+      throw new UDFArgumentLengthException(
+          "The operator 'AND' only accepts 2 argument.");
+    }
+    boi0 = (BooleanObjectInspector) arguments[0];
+    boi1 = (BooleanObjectInspector) arguments[1];
+    return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    boolean bool_a0 = false, bool_a1 = false;
+    BooleanWritable a0 = (BooleanWritable) arguments[0].get();
+    if (a0 != null) {
+      bool_a0 = boi0.get(a0);
+      if (bool_a0 == false) {
+        result.set(false);
+        return result;
+      }
+    }
+
+    BooleanWritable a1 = (BooleanWritable) arguments[1].get();
+    if (a1 != null) {
+      bool_a1 = boi1.get(a1);
+      if (bool_a1 == false) {
+        result.set(false);
+        return result;
+      }
+    }
+
+    if ((a0 != null && bool_a0 == true) && (a1 != null && bool_a1 == true)) {
+      result.set(true);
+      return result;
+    }
+
+    return null;
+  }
+
+  @Override
+  public String getDisplayString(String[] children) {
+    assert (children.length == 2);
+    return "(" + children[0] + " and " + children[1] + ")";
+  }
+
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,88 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+
+/**
+ * GenericUDF Class for operation EQUAL.
+ */
+@Description(name = "=", value = "a _FUNC_ b - Returns TRUE if a equals b and false otherwise")
+public class GenericUDFOPEqual extends GenericUDFBaseCompare {
+  public GenericUDFOPEqual(){
+    this.opName = "EQUAL";
+    this.opDisplayName = "=";
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    Object o0,o1;
+    o0 = arguments[0].get();
+    if (o0 == null) {
+      return null;
+    }
+    o1 = arguments[1].get();
+    if (o1 == null) {
+      return null;
+    }
+
+    switch(compareType) {
+    case COMPARE_TEXT:
+      result.set(soi0.getPrimitiveWritableObject(o0).equals(
+          soi1.getPrimitiveWritableObject(o1)));
+      break;
+    case COMPARE_INT:
+      result.set(ioi0.get(o0) == ioi1.get(o1));
+      break;
+    case COMPARE_LONG:
+      result.set(loi0.get(o0) == loi1.get(o1));
+      break;
+    case COMPARE_BYTE:
+      result.set(byoi0.get(o0) == byoi1.get(o1));
+      break;
+    case COMPARE_BOOL:
+      result.set(boi0.get(o0) == boi1.get(o1));
+      break;
+    case COMPARE_STRING:
+      result.set(soi0.getPrimitiveJavaObject(o0).equals(
+          soi1.getPrimitiveJavaObject(o1)));
+      break;
+    case SAME_TYPE:
+      result.set(ObjectInspectorUtils.compare(
+          o0, argumentOIs[0], o1, argumentOIs[1]) == 0);
+      break;
+    default:
+      Object converted_o0 = converter0.convert(o0);
+      if (converted_o0 == null) {
+        return null;
+      }
+      Object converted_o1 = converter1.convert(o1);
+      if (converted_o1 == null) {
+        return null;
+      }
+      result.set(ObjectInspectorUtils.compare(
+          converted_o0, compareOI,
+          converted_o1, compareOI) == 0);
+    }
+    return result;
+  }
+
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,96 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+import org.apache.hadoop.hive.shims.ShimLoader;
+import org.apache.hadoop.io.Text;
+
+/**
+ * GenericUDF Class for operation EqualOrGreaterThan.
+ */
+@Description(name = ">=", value = "a _FUNC_ b - Returns TRUE if a is not smaller than b")
+public class GenericUDFOPEqualOrGreaterThan extends GenericUDFBaseCompare {
+  public GenericUDFOPEqualOrGreaterThan(){
+    this.opName = "EQUAL OR GREATER THAN";
+    this.opDisplayName = ">=";
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    Object o0,o1;
+    o0 = arguments[0].get();
+    if (o0 == null) {
+      return null;
+    }
+    o1 = arguments[1].get();
+    if (o1 == null) {
+      return null;
+    }
+
+    switch(compareType) {
+    case COMPARE_TEXT:
+      Text t0, t1;
+      t0 = soi0.getPrimitiveWritableObject(o0);
+      t1 = soi1.getPrimitiveWritableObject(o1);
+      result.set(ShimLoader.getHadoopShims().compareText(t0, t1) >= 0);
+      break;
+    case COMPARE_INT:
+      result.set(ioi0.get(o0) >= ioi1.get(o1));
+      break;
+    case COMPARE_LONG:
+      result.set(loi0.get(o0) >= loi1.get(o1));
+      break;
+    case COMPARE_BYTE:
+      result.set(byoi0.get(o0) >= byoi1.get(o1));
+      break;
+    case COMPARE_BOOL:
+      boolean b0 = boi0.get(o0);
+      boolean b1 = boi1.get(o1);
+      result.set(b0 || !b1);
+      break;
+    case COMPARE_STRING:
+      String s0, s1;
+      s0 = soi0.getPrimitiveJavaObject(o0);
+      s1 = soi1.getPrimitiveJavaObject(o1);
+      result.set(s0.compareTo(s1) >= 0);
+      break;
+    case SAME_TYPE:
+      result.set(ObjectInspectorUtils.compare(
+          o0, argumentOIs[0], o1, argumentOIs[1]) >= 0);
+      break;
+    default:
+      Object converted_o0 = converter0.convert(o0);
+      if (converted_o0 == null) {
+        return null;
+      }
+      Object converted_o1 = converter1.convert(o1);
+      if (converted_o1 == null) {
+        return null;
+      }
+      result.set(ObjectInspectorUtils.compare(
+          converted_o0, compareOI,
+          converted_o1, compareOI) >= 0);
+    }
+    return result;
+  }
+
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,97 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+import org.apache.hadoop.hive.shims.ShimLoader;
+import org.apache.hadoop.io.Text;
+
+/**
+ * GenericUDF Class for operation EqualOrLessThan.
+ */
+@Description(name = "<=", value = "a _FUNC_ b - Returns TRUE if a is not greater than b")
+public class GenericUDFOPEqualOrLessThan extends GenericUDFBaseCompare {
+  public GenericUDFOPEqualOrLessThan(){
+    this.opName = "EQUAL OR LESS THAN";
+    this.opDisplayName = "<=";
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    Object o0,o1;
+    o0 = arguments[0].get();
+    if (o0 == null) {
+      return null;
+    }
+    o1 = arguments[1].get();
+    if (o1 == null) {
+      return null;
+    }
+
+    switch(compareType) {
+    case COMPARE_TEXT:
+      Text t0, t1;
+      t0 = soi0.getPrimitiveWritableObject(o0);
+      t1 = soi1.getPrimitiveWritableObject(o1);
+      result.set(ShimLoader.getHadoopShims().compareText(t0, t1) <= 0);
+      break;
+    case COMPARE_INT:
+      result.set(ioi0.get(o0) <= ioi1.get(o1));
+      break;
+    case COMPARE_LONG:
+      result.set(loi0.get(o0) <= loi1.get(o1));
+      break;
+    case COMPARE_BYTE:
+      result.set(byoi0.get(o0) <= byoi1.get(o1));
+      break;
+    case COMPARE_BOOL:
+      boolean b0 = boi0.get(o0);
+      boolean b1 = boi1.get(o1);
+      result.set(!b0 || b1);
+      break;
+    case COMPARE_STRING:
+      String s0, s1;
+      s0 = soi0.getPrimitiveJavaObject(o0);
+      s1 = soi1.getPrimitiveJavaObject(o1);
+      result.set(s0.compareTo(s1) <= 0);
+      break;
+    case SAME_TYPE:
+      result.set(ObjectInspectorUtils.compare(
+          o0, argumentOIs[0], o1, argumentOIs[1]) <= 0);
+      break;
+    default:
+      Object converted_o0 = converter0.convert(o0);
+      if (converted_o0 == null) {
+        return null;
+      }
+      Object converted_o1 = converter1.convert(o1);
+      if (converted_o1 == null) {
+        return null;
+      }
+      result.set(ObjectInspectorUtils.compare(
+          converted_o0, compareOI,
+          converted_o1, compareOI) <= 0);
+    }
+    return result;
+  }
+
+}
+

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,97 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+import org.apache.hadoop.hive.shims.ShimLoader;
+import org.apache.hadoop.io.Text;
+
+/**
+ * GenericUDF Class for operation GreaterThan.
+ */
+@Description(name = ">", value = "a _FUNC_ b - Returns TRUE if a is greater than b")
+public class GenericUDFOPGreaterThan extends GenericUDFBaseCompare {
+  public GenericUDFOPGreaterThan(){
+    this.opName = "GREATER THAN";
+    this.opDisplayName = ">";
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    Object o0,o1;
+    o0 = arguments[0].get();
+    if (o0 == null) {
+      return null;
+    }
+    o1 = arguments[1].get();
+    if (o1 == null) {
+      return null;
+    }
+
+    switch(compareType) {
+    case COMPARE_TEXT:
+      Text t0, t1;
+      t0 = soi0.getPrimitiveWritableObject(o0);
+      t1 = soi1.getPrimitiveWritableObject(o1);
+      result.set(ShimLoader.getHadoopShims().compareText(t0, t1) > 0);
+      break;
+    case COMPARE_INT:
+      result.set(ioi0.get(o0) > ioi1.get(o1));
+      break;
+    case COMPARE_LONG:
+      result.set(loi0.get(o0) > loi1.get(o1));
+      break;
+    case COMPARE_BYTE:
+      result.set(byoi0.get(o0) > byoi1.get(o1));
+      break;
+    case COMPARE_BOOL:
+      boolean b0 = boi0.get(o0);
+      boolean b1 = boi1.get(o1);
+      result.set(b0 && !b1);
+      break;
+    case COMPARE_STRING:
+      String s0, s1;
+      s0 = soi0.getPrimitiveJavaObject(o0);
+      s1 = soi1.getPrimitiveJavaObject(o1);
+      result.set(s0.compareTo(s1) > 0);
+      break;
+    case SAME_TYPE:
+      result.set(ObjectInspectorUtils.compare(
+          o0, argumentOIs[0], o1, argumentOIs[1]) > 0);
+      break;
+    default:
+      Object converted_o0 = converter0.convert(o0);
+      if (converted_o0 == null) {
+        return null;
+      }
+      Object converted_o1 = converter1.convert(o1);
+      if (converted_o1 == null) {
+        return null;
+      }
+      result.set(ObjectInspectorUtils.compare(
+          converted_o0, compareOI,
+          converted_o1, compareOI) > 0);
+    }
+    return result;
+  }
+
+}
+

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,96 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+import org.apache.hadoop.hive.shims.ShimLoader;
+import org.apache.hadoop.io.Text;
+
+/**
+ * GenericUDF Class for operation LessThan.
+ */
+@Description(name = "<", value = "a _FUNC_ b - Returns TRUE if a is less than b")
+public class GenericUDFOPLessThan extends GenericUDFBaseCompare {
+  public GenericUDFOPLessThan(){
+    this.opName = "LESS THAN";
+    this.opDisplayName = "<";
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    Object o0,o1;
+    o0 = arguments[0].get();
+    if (o0 == null) {
+      return null;
+    }
+    o1 = arguments[1].get();
+    if (o1 == null) {
+      return null;
+    }
+
+    switch(compareType) {
+    case COMPARE_TEXT:
+      Text t0, t1;
+      t0 = soi0.getPrimitiveWritableObject(o0);
+      t1 = soi1.getPrimitiveWritableObject(o1);
+      result.set(ShimLoader.getHadoopShims().compareText(t0, t1) < 0);
+      break;
+    case COMPARE_INT:
+      result.set(ioi0.get(o0) < ioi1.get(o1));
+      break;
+    case COMPARE_LONG:
+      result.set(loi0.get(o0) < loi1.get(o1));
+      break;
+    case COMPARE_BYTE:
+      result.set(byoi0.get(o0) < byoi1.get(o1));
+      break;
+    case COMPARE_BOOL:
+      boolean b0 = boi0.get(o0);
+      boolean b1 = boi1.get(o1);
+      result.set(!b0 && b1);
+      break;
+    case COMPARE_STRING:
+      String s0, s1;
+      s0 = soi0.getPrimitiveJavaObject(o0);
+      s1 = soi1.getPrimitiveJavaObject(o1);
+      result.set(s0.compareTo(s1) < 0);
+      break;
+    case SAME_TYPE:
+      result.set(ObjectInspectorUtils.compare(
+          o0, argumentOIs[0], o1, argumentOIs[1]) < 0);
+      break;
+    default:
+      Object converted_o0 = converter0.convert(o0);
+      if (converted_o0 == null) {
+        return null;
+      }
+      Object converted_o1 = converter1.convert(o1);
+      if (converted_o1 == null) {
+        return null;
+      }
+      result.set(ObjectInspectorUtils.compare(
+          converted_o0, compareOI,
+          converted_o1, compareOI) < 0);
+    }
+    return result;
+  }
+
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNot.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNot.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNot.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNot.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,66 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.BooleanObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.io.BooleanWritable;
+
+/**
+ * GenericUDFOPNot.
+ *
+ */
+@Description(name = "not", value = "_FUNC_ a - Logical not")
+public class GenericUDFOPNot extends GenericUDF {
+  private final BooleanWritable result = new BooleanWritable();
+  BooleanObjectInspector boi;
+
+  @Override
+  public ObjectInspector initialize(ObjectInspector[] arguments)
+      throws UDFArgumentException {
+    if (arguments.length != 1) {
+      throw new UDFArgumentLengthException(
+          "The operator NOT only accepts 1 argument.");
+    }
+    boi = (BooleanObjectInspector) arguments[0];
+    return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    Object a0 = arguments[0].get();
+    if (a0 == null) {
+      return null;
+    }
+    result.set(!boi.get(a0));
+    return result;
+  }
+
+  @Override
+  public String getDisplayString(String[] children) {
+    assert (children.length == 1);
+    return "(not " + children[0] + ")";
+  }
+
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,87 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+
+/**
+ * GenericUDF Class for operation Not EQUAL.
+ */
+@Description(name = "=", value = "a _FUNC_ b - Returns TRUE if a is not equal to b")
+public class GenericUDFOPNotEqual extends GenericUDFBaseCompare {
+  public GenericUDFOPNotEqual(){
+    this.opName = "NOT EQUAL";
+    this.opDisplayName = "<>";
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    Object o0,o1;
+    o0 = arguments[0].get();
+    if (o0 == null) {
+      return null;
+    }
+    o1 = arguments[1].get();
+    if (o1 == null) {
+      return null;
+    }
+
+    switch(compareType) {
+    case COMPARE_TEXT:
+      result.set(!soi0.getPrimitiveWritableObject(o0).equals(
+          soi1.getPrimitiveWritableObject(o1)));
+      break;
+    case COMPARE_INT:
+      result.set(ioi0.get(o0) != ioi1.get(o1));
+      break;
+    case COMPARE_LONG:
+      result.set(loi0.get(o0) != loi1.get(o1));
+      break;
+    case COMPARE_BYTE:
+      result.set(byoi0.get(o0) != byoi1.get(o1));
+      break;
+    case COMPARE_BOOL:
+      result.set(boi0.get(o0) != boi1.get(o1));
+      break;
+    case COMPARE_STRING:
+      result.set(!soi0.getPrimitiveJavaObject(o0).equals(
+          soi1.getPrimitiveJavaObject(o1)));
+      break;
+    case SAME_TYPE:
+      result.set(ObjectInspectorUtils.compare(
+          o0, argumentOIs[0], o1, argumentOIs[1]) != 0);
+      break;
+    default:
+      Object converted_o0 = converter0.convert(o0);
+      if (converted_o0 == null) {
+        return null;
+      }
+      Object converted_o1 = converter1.convert(o1);
+      if (converted_o1 == null) {
+        return null;
+      }
+      result.set(ObjectInspectorUtils.compare(
+          converted_o0, compareOI,
+          converted_o1, compareOI) != 0);
+    }
+    return result;
+  }
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPOr.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPOr.java?rev=1024116&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPOr.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPOr.java Tue Oct 19 05:17:02 2010
@@ -0,0 +1,85 @@
+/**
+ * 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.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.BooleanObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.io.BooleanWritable;
+
+/**
+ * GenericUDF Class for computing or.
+ */
+@Description(name = "or", value = "a _FUNC_ b - Logical or")
+public class GenericUDFOPOr extends GenericUDF {
+  private final BooleanWritable result = new BooleanWritable();
+  BooleanObjectInspector boi0,boi1;
+
+  @Override
+  public ObjectInspector initialize(ObjectInspector[] arguments)
+      throws UDFArgumentException {
+    if (arguments.length != 2) {
+      throw new UDFArgumentLengthException(
+          "The operator 'AND' only accepts 2 argument.");
+    }
+    boi0 = (BooleanObjectInspector) arguments[0];
+    boi1 = (BooleanObjectInspector) arguments[1];
+    return PrimitiveObjectInspectorFactory.writableBooleanObjectInspector;
+  }
+
+  @Override
+  public Object evaluate(DeferredObject[] arguments) throws HiveException {
+    boolean bool_a0 = false, bool_a1 = false;
+    BooleanWritable a0 = (BooleanWritable) arguments[0].get();
+    if (a0 != null) {
+      bool_a0 = boi0.get(a0);
+      if (bool_a0 == true) {
+        result.set(true);
+        return result;
+      }
+    }
+
+    BooleanWritable a1 = (BooleanWritable) arguments[1].get();
+    if (a1 != null) {
+      bool_a1 = boi1.get(a1);
+      if (bool_a1 == true) {
+        result.set(true);
+        return result;
+      }
+    }
+
+    if ((a0 != null && bool_a0 == false) && (a1 != null && bool_a1 == false)) {
+      result.set(false);
+      return result;
+    }
+
+    return null;
+  }
+
+  @Override
+  public String getDisplayString(String[] children) {
+    assert (children.length == 2);
+    return "(" + children[0] + " or " + children[1] + ")";
+  }
+
+}

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_greaterthanorequal.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_greaterthanorequal.q.out?rev=1024116&r1=1024115&r2=1024116&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_greaterthanorequal.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_greaterthanorequal.q.out Tue Oct 19 05:17:02 2010
@@ -2,18 +2,18 @@ PREHOOK: query: DESCRIBE FUNCTION >=
 PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: DESCRIBE FUNCTION >=
 POSTHOOK: type: DESCFUNCTION
-a >= b - Returns TRUE if b is not smaller than a
+a >= b - Returns TRUE if a is not smaller than b
 PREHOOK: query: DESCRIBE FUNCTION EXTENDED >=
 PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: DESCRIBE FUNCTION EXTENDED >=
 POSTHOOK: type: DESCFUNCTION
-a >= b - Returns TRUE if b is not smaller than a
+a >= b - Returns TRUE if a is not smaller than b
 PREHOOK: query: SELECT true>=false, false>=true, false>=false, true>=true FROM src LIMIT 1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
-PREHOOK: Output: file:/data/users/pyang/mstore/trunk/VENDOR.hive/trunk/build/ql/scratchdir/hive_2010-04-14_15-38-26_830_745034439856049454/10000
+PREHOOK: Output: file:/tmp/sdong/hive_2010-09-29_14-46-47_233_3050706776311320694/-mr-10000
 POSTHOOK: query: SELECT true>=false, false>=true, false>=false, true>=true FROM src LIMIT 1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
-POSTHOOK: Output: file:/data/users/pyang/mstore/trunk/VENDOR.hive/trunk/build/ql/scratchdir/hive_2010-04-14_15-38-26_830_745034439856049454/10000
+POSTHOOK: Output: file:/tmp/sdong/hive_2010-09-29_14-46-47_233_3050706776311320694/-mr-10000
 true	false	true	true

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_lessthanorequal.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_lessthanorequal.q.out?rev=1024116&r1=1024115&r2=1024116&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_lessthanorequal.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/udf_lessthanorequal.q.out Tue Oct 19 05:17:02 2010
@@ -2,18 +2,18 @@ PREHOOK: query: DESCRIBE FUNCTION <=
 PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: DESCRIBE FUNCTION <=
 POSTHOOK: type: DESCFUNCTION
-a <= b - Returns TRUE if b is not greater than a
+a <= b - Returns TRUE if a is not greater than b
 PREHOOK: query: DESCRIBE FUNCTION EXTENDED <=
 PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: DESCRIBE FUNCTION EXTENDED <=
 POSTHOOK: type: DESCFUNCTION
-a <= b - Returns TRUE if b is not greater than a
+a <= b - Returns TRUE if a is not greater than b
 PREHOOK: query: SELECT true<=false, false<=true, false<=false, true<=true FROM src LIMIT 1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
-PREHOOK: Output: file:/data/users/pyang/mstore/trunk/VENDOR.hive/trunk/build/ql/scratchdir/hive_2010-04-14_15-36-38_643_4822148186689079902/10000
+PREHOOK: Output: file:/tmp/sdong/hive_2010-09-28_11-53-20_959_7206893902917373774/-mr-10000
 POSTHOOK: query: SELECT true<=false, false<=true, false<=false, true<=true FROM src LIMIT 1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
-POSTHOOK: Output: file:/data/users/pyang/mstore/trunk/VENDOR.hive/trunk/build/ql/scratchdir/hive_2010-04-14_15-36-38_643_4822148186689079902/10000
+POSTHOOK: Output: file:/tmp/sdong/hive_2010-09-28_11-53-20_959_7206893902917373774/-mr-10000
 false	true	true	true

Modified: hadoop/hive/trunk/ql/src/test/results/compiler/plan/case_sensitivity.q.xml
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/compiler/plan/case_sensitivity.q.xml?rev=1024116&r1=1024115&r2=1024116&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/compiler/plan/case_sensitivity.q.xml (original)
+++ hadoop/hive/trunk/ql/src/test/results/compiler/plan/case_sensitivity.q.xml Tue Oct 19 05:17:02 2010
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.6.0_14" class="java.beans.XMLDecoder"> 
+<java version="1.6.0_07" class="java.beans.XMLDecoder"> 
  <object id="MapRedTask0" class="org.apache.hadoop.hive.ql.exec.MapRedTask"> 
   <void property="childTasks"> 
    <object class="java.util.ArrayList"> 
@@ -33,7 +33,7 @@
                   <void property="work"> 
                    <object class="org.apache.hadoop.hive.ql.plan.StatsWork"> 
                     <void property="aggKey"> 
-                     <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10000/</string> 
+                     <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10000/</string> 
                     </void> 
                    </object> 
                   </void> 
@@ -73,7 +73,7 @@
                     <void property="aliasToWork"> 
                      <object class="java.util.LinkedHashMap"> 
                       <void method="put"> 
-                       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10002</string> 
+                       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10002</string> 
                        <object id="TableScanOperator0" class="org.apache.hadoop.hive.ql.exec.TableScanOperator"> 
                         <void property="childOperators"> 
                          <object class="java.util.ArrayList"> 
@@ -82,7 +82,7 @@
                             <void property="conf"> 
                              <object class="org.apache.hadoop.hive.ql.plan.FileSinkDesc"> 
                               <void property="dirName"> 
-                               <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10000</string> 
+                               <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10000</string> 
                               </void> 
                               <void property="numFiles"> 
                                <int>1</int> 
@@ -134,7 +134,7 @@
                                   </void> 
                                   <void method="put"> 
                                    <string>location</string> 
-                                   <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/dest1</string> 
+                                   <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/dest1</string> 
                                   </void> 
                                   <void method="put"> 
                                    <string>file.outputformat</string> 
@@ -142,7 +142,7 @@
                                   </void> 
                                   <void method="put"> 
                                    <string>transient_lastDdlTime</string> 
-                                   <string>1285059859</string> 
+                                   <string>1287464729</string> 
                                   </void> 
                                  </object> 
                                 </void> 
@@ -253,10 +253,10 @@
                     <void property="pathToAliases"> 
                      <object class="java.util.LinkedHashMap"> 
                       <void method="put"> 
-                       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10002</string> 
+                       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10002</string> 
                        <object class="java.util.ArrayList"> 
                         <void method="add"> 
-                         <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10002</string> 
+                         <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10002</string> 
                         </void> 
                        </object> 
                       </void> 
@@ -265,7 +265,7 @@
                     <void property="pathToPartitionInfo"> 
                      <object class="java.util.LinkedHashMap"> 
                       <void method="put"> 
-                       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10002</string> 
+                       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10002</string> 
                        <object class="org.apache.hadoop.hive.ql.plan.PartitionDesc"> 
                         <void property="baseFileName"> 
                          <string>-ext-10002</string> 
@@ -319,11 +319,11 @@
                           </void> 
                           <void method="put"> 
                            <string>location</string> 
-                           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/dest1</string> 
+                           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/dest1</string> 
                           </void> 
                           <void method="put"> 
                            <string>transient_lastDdlTime</string> 
-                           <string>1285059859</string> 
+                           <string>1287464729</string> 
                           </void> 
                          </object> 
                         </void> 
@@ -373,13 +373,13 @@
                    <boolean>true</boolean> 
                   </void> 
                   <void property="sourceDir"> 
-                   <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10000</string> 
+                   <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10000</string> 
                   </void> 
                   <void property="table"> 
                    <object idref="TableDesc0"/> 
                   </void> 
                   <void property="tmpDir"> 
-                   <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10001</string> 
+                   <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10001</string> 
                   </void> 
                  </object> 
                 </void> 
@@ -400,10 +400,10 @@
                <boolean>true</boolean> 
               </void> 
               <void property="sourceDir"> 
-               <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10002</string> 
+               <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10002</string> 
               </void> 
               <void property="targetDir"> 
-               <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10000</string> 
+               <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10000</string> 
               </void> 
              </object> 
             </void> 
@@ -429,7 +429,7 @@
       <void property="resolverCtx"> 
        <object class="org.apache.hadoop.hive.ql.plan.ConditionalResolverMergeFiles$ConditionalResolverMergeFilesCtx"> 
         <void property="dir"> 
-         <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10002</string> 
+         <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10002</string> 
         </void> 
         <void property="listTasks"> 
          <object idref="ArrayList0"/> 
@@ -519,11 +519,11 @@
          </void> 
          <void method="put"> 
           <string>location</string> 
-          <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src_thrift</string> 
+          <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src_thrift</string> 
          </void> 
          <void method="put"> 
           <string>transient_lastDdlTime</string> 
-          <string>1285059858</string> 
+          <string>1287464728</string> 
          </void> 
         </object> 
        </void> 
@@ -579,7 +579,7 @@
                            <int>1</int> 
                           </void> 
                           <void property="dirName"> 
-                           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10002</string> 
+                           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10002</string> 
                           </void> 
                           <void property="gatherStats"> 
                            <boolean>true</boolean> 
@@ -588,7 +588,7 @@
                            <int>1</int> 
                           </void> 
                           <void property="statsAggPrefix"> 
-                           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-04-19_598_2303560956024146796/-ext-10000/</string> 
+                           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-05-29_589_3396533530052421249/-ext-10000/</string> 
                           </void> 
                           <void property="tableInfo"> 
                            <object idref="TableDesc0"/> 
@@ -901,17 +901,7 @@
                      </object> 
                     </void> 
                     <void property="genericUDF"> 
-                     <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge"> 
-                      <void property="operator"> 
-                       <boolean>true</boolean> 
-                      </void> 
-                      <void property="udfClass"> 
-                       <class>org.apache.hadoop.hive.ql.udf.UDFOPGreaterThan</class> 
-                      </void> 
-                      <void property="udfName"> 
-                       <string>&gt;</string> 
-                      </void> 
-                     </object> 
+                     <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"/> 
                     </void> 
                     <void property="typeInfo"> 
                      <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
@@ -1038,17 +1028,7 @@
                  </object> 
                 </void> 
                 <void property="genericUDF"> 
-                 <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge"> 
-                  <void property="operator"> 
-                   <boolean>true</boolean> 
-                  </void> 
-                  <void property="udfClass"> 
-                   <class>org.apache.hadoop.hive.ql.udf.UDFOPGreaterThan</class> 
-                  </void> 
-                  <void property="udfName"> 
-                   <string>&gt;</string> 
-                  </void> 
-                 </object> 
+                 <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"/> 
                 </void> 
                 <void property="typeInfo"> 
                  <object idref="PrimitiveTypeInfo2"/> 
@@ -1232,7 +1212,7 @@
     <void property="pathToAliases"> 
      <object class="java.util.LinkedHashMap"> 
       <void method="put"> 
-       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src_thrift</string> 
+       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src_thrift</string> 
        <object class="java.util.ArrayList"> 
         <void method="add"> 
          <string>src_thrift</string> 
@@ -1244,7 +1224,7 @@
     <void property="pathToPartitionInfo"> 
      <object class="java.util.LinkedHashMap"> 
       <void method="put"> 
-       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src_thrift</string> 
+       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src_thrift</string> 
        <object class="org.apache.hadoop.hive.ql.plan.PartitionDesc"> 
         <void property="baseFileName"> 
          <string>src_thrift</string> 
@@ -1305,11 +1285,11 @@
           </void> 
           <void method="put"> 
            <string>location</string> 
-           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src_thrift</string> 
+           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src_thrift</string> 
           </void> 
           <void method="put"> 
            <string>transient_lastDdlTime</string> 
-           <string>1285059858</string> 
+           <string>1287464728</string> 
           </void> 
          </object> 
         </void> 

Modified: hadoop/hive/trunk/ql/src/test/results/compiler/plan/cast1.q.xml
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/compiler/plan/cast1.q.xml?rev=1024116&r1=1024115&r2=1024116&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/compiler/plan/cast1.q.xml (original)
+++ hadoop/hive/trunk/ql/src/test/results/compiler/plan/cast1.q.xml Tue Oct 19 05:17:02 2010
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.6.0_14" class="java.beans.XMLDecoder"> 
+<java version="1.6.0_07" class="java.beans.XMLDecoder"> 
  <object class="org.apache.hadoop.hive.ql.exec.MapRedTask"> 
   <void property="id"> 
    <string>Stage-3</string> 
@@ -62,11 +62,11 @@
          </void> 
          <void method="put"> 
           <string>location</string> 
-          <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+          <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
          </void> 
          <void method="put"> 
           <string>transient_lastDdlTime</string> 
-          <string>1284514942</string> 
+          <string>1287464740</string> 
          </void> 
         </object> 
        </void> 
@@ -119,13 +119,13 @@
                         <void property="conf"> 
                          <object class="org.apache.hadoop.hive.ql.plan.FileSinkDesc"> 
                           <void property="dirName"> 
-                           <string>file:/tmp/nzhang/hive_2010-09-14_18-42-27_556_1287140404332430285/-ext-10001</string> 
+                           <string>file:/tmp/njain/hive_2010-10-18_22-05-42_920_5835011368518558093/-ext-10001</string> 
                           </void> 
                           <void property="numFiles"> 
                            <int>1</int> 
                           </void> 
                           <void property="statsAggPrefix"> 
-                           <string>file:/tmp/nzhang/hive_2010-09-14_18-42-27_556_1287140404332430285/-ext-10001/</string> 
+                           <string>file:/tmp/njain/hive_2010-10-18_22-05-42_920_5835011368518558093/-ext-10001/</string> 
                           </void> 
                           <void property="tableInfo"> 
                            <object class="org.apache.hadoop.hive.ql.plan.TableDesc"> 
@@ -814,17 +814,7 @@
                      </object> 
                     </void> 
                     <void property="genericUDF"> 
-                     <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge"> 
-                      <void property="operator"> 
-                       <boolean>true</boolean> 
-                      </void> 
-                      <void property="udfClass"> 
-                       <class>org.apache.hadoop.hive.ql.udf.UDFOPEqual</class> 
-                      </void> 
-                      <void property="udfName"> 
-                       <string>=</string> 
-                      </void> 
-                     </object> 
+                     <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"/> 
                     </void> 
                     <void property="typeInfo"> 
                      <object idref="PrimitiveTypeInfo2"/> 
@@ -913,17 +903,7 @@
                  </object> 
                 </void> 
                 <void property="genericUDF"> 
-                 <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge"> 
-                  <void property="operator"> 
-                   <boolean>true</boolean> 
-                  </void> 
-                  <void property="udfClass"> 
-                   <class>org.apache.hadoop.hive.ql.udf.UDFOPEqual</class> 
-                  </void> 
-                  <void property="udfName"> 
-                   <string>=</string> 
-                  </void> 
-                 </object> 
+                 <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"/> 
                 </void> 
                 <void property="typeInfo"> 
                  <object idref="PrimitiveTypeInfo2"/> 
@@ -1057,7 +1037,7 @@
     <void property="pathToAliases"> 
      <object class="java.util.LinkedHashMap"> 
       <void method="put"> 
-       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
        <object class="java.util.ArrayList"> 
         <void method="add"> 
          <string>src</string> 
@@ -1069,7 +1049,7 @@
     <void property="pathToPartitionInfo"> 
      <object class="java.util.LinkedHashMap"> 
       <void method="put"> 
-       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
        <object class="org.apache.hadoop.hive.ql.plan.PartitionDesc"> 
         <void property="baseFileName"> 
          <string>src</string> 
@@ -1126,11 +1106,11 @@
           </void> 
           <void method="put"> 
            <string>location</string> 
-           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
           </void> 
           <void method="put"> 
            <string>transient_lastDdlTime</string> 
-           <string>1284514942</string> 
+           <string>1287464740</string> 
           </void> 
          </object> 
         </void> 

Modified: hadoop/hive/trunk/ql/src/test/results/compiler/plan/input1.q.xml
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/compiler/plan/input1.q.xml?rev=1024116&r1=1024115&r2=1024116&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/compiler/plan/input1.q.xml (original)
+++ hadoop/hive/trunk/ql/src/test/results/compiler/plan/input1.q.xml Tue Oct 19 05:17:02 2010
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.6.0_14" class="java.beans.XMLDecoder"> 
+<java version="1.6.0_07" class="java.beans.XMLDecoder"> 
  <object id="MapRedTask0" class="org.apache.hadoop.hive.ql.exec.MapRedTask"> 
   <void property="childTasks"> 
    <object class="java.util.ArrayList"> 
@@ -33,7 +33,7 @@
                   <void property="work"> 
                    <object class="org.apache.hadoop.hive.ql.plan.StatsWork"> 
                     <void property="aggKey"> 
-                     <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10000/</string> 
+                     <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10000/</string> 
                     </void> 
                    </object> 
                   </void> 
@@ -73,7 +73,7 @@
                     <void property="aliasToWork"> 
                      <object class="java.util.LinkedHashMap"> 
                       <void method="put"> 
-                       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10002</string> 
+                       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10002</string> 
                        <object id="TableScanOperator0" class="org.apache.hadoop.hive.ql.exec.TableScanOperator"> 
                         <void property="childOperators"> 
                          <object class="java.util.ArrayList"> 
@@ -82,7 +82,7 @@
                             <void property="conf"> 
                              <object class="org.apache.hadoop.hive.ql.plan.FileSinkDesc"> 
                               <void property="dirName"> 
-                               <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10000</string> 
+                               <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10000</string> 
                               </void> 
                               <void property="numFiles"> 
                                <int>1</int> 
@@ -134,7 +134,7 @@
                                   </void> 
                                   <void method="put"> 
                                    <string>location</string> 
-                                   <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/dest1</string> 
+                                   <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/dest1</string> 
                                   </void> 
                                   <void method="put"> 
                                    <string>file.outputformat</string> 
@@ -142,7 +142,7 @@
                                   </void> 
                                   <void method="put"> 
                                    <string>transient_lastDdlTime</string> 
-                                   <string>1285059952</string> 
+                                   <string>1287464827</string> 
                                   </void> 
                                  </object> 
                                 </void> 
@@ -253,10 +253,10 @@
                     <void property="pathToAliases"> 
                      <object class="java.util.LinkedHashMap"> 
                       <void method="put"> 
-                       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10002</string> 
+                       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10002</string> 
                        <object class="java.util.ArrayList"> 
                         <void method="add"> 
-                         <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10002</string> 
+                         <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10002</string> 
                         </void> 
                        </object> 
                       </void> 
@@ -265,7 +265,7 @@
                     <void property="pathToPartitionInfo"> 
                      <object class="java.util.LinkedHashMap"> 
                       <void method="put"> 
-                       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10002</string> 
+                       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10002</string> 
                        <object class="org.apache.hadoop.hive.ql.plan.PartitionDesc"> 
                         <void property="baseFileName"> 
                          <string>-ext-10002</string> 
@@ -319,11 +319,11 @@
                           </void> 
                           <void method="put"> 
                            <string>location</string> 
-                           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/dest1</string> 
+                           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/dest1</string> 
                           </void> 
                           <void method="put"> 
                            <string>transient_lastDdlTime</string> 
-                           <string>1285059952</string> 
+                           <string>1287464827</string> 
                           </void> 
                          </object> 
                         </void> 
@@ -373,13 +373,13 @@
                    <boolean>true</boolean> 
                   </void> 
                   <void property="sourceDir"> 
-                   <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10000</string> 
+                   <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10000</string> 
                   </void> 
                   <void property="table"> 
                    <object idref="TableDesc0"/> 
                   </void> 
                   <void property="tmpDir"> 
-                   <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10001</string> 
+                   <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10001</string> 
                   </void> 
                  </object> 
                 </void> 
@@ -400,10 +400,10 @@
                <boolean>true</boolean> 
               </void> 
               <void property="sourceDir"> 
-               <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10002</string> 
+               <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10002</string> 
               </void> 
               <void property="targetDir"> 
-               <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10000</string> 
+               <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10000</string> 
               </void> 
              </object> 
             </void> 
@@ -429,7 +429,7 @@
       <void property="resolverCtx"> 
        <object class="org.apache.hadoop.hive.ql.plan.ConditionalResolverMergeFiles$ConditionalResolverMergeFilesCtx"> 
         <void property="dir"> 
-         <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10002</string> 
+         <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10002</string> 
         </void> 
         <void property="listTasks"> 
          <object idref="ArrayList0"/> 
@@ -515,11 +515,11 @@
          </void> 
          <void method="put"> 
           <string>location</string> 
-          <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+          <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
          </void> 
          <void method="put"> 
           <string>transient_lastDdlTime</string> 
-          <string>1285059950</string> 
+          <string>1287464824</string> 
          </void> 
         </object> 
        </void> 
@@ -575,7 +575,7 @@
                            <int>1</int> 
                           </void> 
                           <void property="dirName"> 
-                           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10002</string> 
+                           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10002</string> 
                           </void> 
                           <void property="gatherStats"> 
                            <boolean>true</boolean> 
@@ -584,7 +584,7 @@
                            <int>1</int> 
                           </void> 
                           <void property="statsAggPrefix"> 
-                           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-09-21_02-05-53_127_8730853387776623391/-ext-10000/</string> 
+                           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/scratchdir/hive_2010-10-18_22-07-07_733_11229797802357193/-ext-10000/</string> 
                           </void> 
                           <void property="tableInfo"> 
                            <object idref="TableDesc0"/> 
@@ -777,17 +777,7 @@
                      </object> 
                     </void> 
                     <void property="genericUDF"> 
-                     <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge"> 
-                      <void property="operator"> 
-                       <boolean>true</boolean> 
-                      </void> 
-                      <void property="udfClass"> 
-                       <class>org.apache.hadoop.hive.ql.udf.UDFOPLessThan</class> 
-                      </void> 
-                      <void property="udfName"> 
-                       <string>&lt;</string> 
-                      </void> 
-                     </object> 
+                     <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"/> 
                     </void> 
                     <void property="typeInfo"> 
                      <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
@@ -890,17 +880,7 @@
                  </object> 
                 </void> 
                 <void property="genericUDF"> 
-                 <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge"> 
-                  <void property="operator"> 
-                   <boolean>true</boolean> 
-                  </void> 
-                  <void property="udfClass"> 
-                   <class>org.apache.hadoop.hive.ql.udf.UDFOPLessThan</class> 
-                  </void> 
-                  <void property="udfName"> 
-                   <string>&lt;</string> 
-                  </void> 
-                 </object> 
+                 <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"/> 
                 </void> 
                 <void property="typeInfo"> 
                  <object idref="PrimitiveTypeInfo2"/> 
@@ -1033,7 +1013,7 @@
     <void property="pathToAliases"> 
      <object class="java.util.LinkedHashMap"> 
       <void method="put"> 
-       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
        <object class="java.util.ArrayList"> 
         <void method="add"> 
          <string>src</string> 
@@ -1045,7 +1025,7 @@
     <void property="pathToPartitionInfo"> 
      <object class="java.util.LinkedHashMap"> 
       <void method="put"> 
-       <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+       <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
        <object class="org.apache.hadoop.hive.ql.plan.PartitionDesc"> 
         <void property="baseFileName"> 
          <string>src</string> 
@@ -1102,11 +1082,11 @@
           </void> 
           <void method="put"> 
            <string>location</string> 
-           <string>pfile:/data/users/nzhang/work/784/apache-hive/build/ql/test/data/warehouse/src</string> 
+           <string>pfile:/data/users/njain/hive_commit2/hive_commit2/build/ql/test/data/warehouse/src</string> 
           </void> 
           <void method="put"> 
            <string>transient_lastDdlTime</string> 
-           <string>1285059950</string> 
+           <string>1287464824</string> 
           </void> 
          </object> 
         </void>