You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2013/11/20 06:40:48 UTC

svn commit: r1543711 [2/4] - in /hive/trunk: common/src/test/org/apache/hadoop/hive/common/type/ ql/src/java/org/apache/hadoop/hive/ql/exec/ ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/j...

Added: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java?rev=1543711&view=auto
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java (added)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java Wed Nov 20 05:40:46 2013
@@ -0,0 +1,204 @@
+/**
+ * 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.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.ByteWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.io.FloatWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestGenericUDFOPMinus {
+
+  @Test
+  public void testByteMinusShort() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    ByteWritable left = new ByteWritable((byte) 4);
+    ShortWritable right = new ShortWritable((short) 6);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableByteObjectInspector,
+        PrimitiveObjectInspectorFactory.writableShortObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.shortTypeInfo);
+    ShortWritable res = (ShortWritable) udf.evaluate(args);
+    Assert.assertEquals(-2, res.get());
+  }
+
+  @Test
+  public void testVarcharMinusInt() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    HiveVarcharWritable left = new HiveVarcharWritable();
+    left.set("123");
+    IntWritable right = new IntWritable(456);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableHiveVarcharObjectInspector,
+        PrimitiveObjectInspectorFactory.writableIntObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.doubleTypeInfo);
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(-333.0), new Double(res.get()));
+  }
+
+  @Test
+  public void testDoubleMinusLong() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    // Int
+    DoubleWritable left = new DoubleWritable(4.5);
+    LongWritable right = new LongWritable(10);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.doubleTypeInfo, oi.getTypeInfo());
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(-5.5), new Double(res.get()));
+  }
+
+  @Test
+  public void testLongMinusDecimal() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    LongWritable left = new LongWritable(104);
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector,
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(9, 4))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(24,4), oi.getTypeInfo());
+    HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertEquals(HiveDecimal.create("-130.97"), res.getHiveDecimal());
+  }
+
+  @Test
+  public void testFloatMinusFloat() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    FloatWritable f1 = new FloatWritable(4.5f);
+    FloatWritable f2 = new FloatWritable(0.0f);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector,
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(f1),
+        new DeferredJavaObject(f2),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.doubleTypeInfo);
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(4.5), new Double(res.get()));
+  }
+
+  @Test
+  public void testDouleMinusDecimal() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    DoubleWritable left = new DoubleWritable(74.52);
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.doubleTypeInfo, oi.getTypeInfo());
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(-160.45), new Double(res.get()));
+  }
+
+  @Test
+  public void testDecimalMinusDecimal() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    HiveDecimalWritable left = new HiveDecimalWritable(HiveDecimal.create("14.5"));
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(3, 1)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(6,2), oi.getTypeInfo());
+    HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertEquals( HiveDecimal.create("-220.47"), res.getHiveDecimal());
+  }
+
+  @Test
+  public void testDecimalMinusDecimalSameParams() throws HiveException {
+    GenericUDFOPMinus udf = new GenericUDFOPMinus();
+
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(6, 2), oi.getTypeInfo());
+  }
+
+}

Added: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMod.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMod.java?rev=1543711&view=auto
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMod.java (added)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMod.java Wed Nov 20 05:40:46 2013
@@ -0,0 +1,214 @@
+/**
+ * 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.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.ByteWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.io.FloatWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestGenericUDFOPMod {
+
+  @Test
+  public void testModByZero1() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    // Byte
+    ByteWritable b1 = new ByteWritable((byte) 4);
+    ByteWritable b2 = new ByteWritable((byte) 0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableByteObjectInspector,
+        PrimitiveObjectInspectorFactory.writableByteObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(b1),
+        new DeferredJavaObject(b2),
+    };
+
+    udf.initialize(inputOIs);
+    ByteWritable b3 = (ByteWritable) udf.evaluate(args);
+    Assert.assertNull(b3);
+  }
+
+  @Test
+  public void testModByZero2() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    // Short
+    ShortWritable s1 = new ShortWritable((short) 4);
+    ShortWritable s2 = new ShortWritable((short) 0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableShortObjectInspector,
+        PrimitiveObjectInspectorFactory.writableShortObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(s1),
+        new DeferredJavaObject(s2),
+    };
+
+    udf.initialize(inputOIs);
+    ShortWritable s3 = (ShortWritable) udf.evaluate(args);
+    Assert.assertNull(s3);
+  }
+
+  @Test
+  public void testModByZero3() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    // Int
+    IntWritable i1 = new IntWritable(4);
+    IntWritable i2 = new IntWritable(0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableIntObjectInspector,
+        PrimitiveObjectInspectorFactory.writableIntObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(i1),
+        new DeferredJavaObject(i2),
+    };
+
+    udf.initialize(inputOIs);
+    IntWritable i3 = (IntWritable) udf.evaluate(args);
+    Assert.assertNull(i3);
+  }
+
+  @Test
+  public void testModByZero4() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    // Long
+    LongWritable l1 = new LongWritable(4);
+    LongWritable l2 = new LongWritable(0L);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector,
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(l1),
+        new DeferredJavaObject(l2),
+    };
+
+    udf.initialize(inputOIs);
+    LongWritable l3 = (LongWritable) udf.evaluate(args);
+    Assert.assertNull(l3);
+  }
+
+  @Test
+  public void testModByZero5() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    // Float
+    FloatWritable f1 = new FloatWritable(4.5f);
+    FloatWritable f2 = new FloatWritable(0.0f);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector,
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(f1),
+        new DeferredJavaObject(f2),
+    };
+
+    udf.initialize(inputOIs);
+    DoubleWritable f3 = (DoubleWritable) udf.evaluate(args);
+    Assert.assertNull(f3);
+  }
+
+  @Test
+  public void testModByZero6() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    // Double
+    DoubleWritable d1 = new DoubleWritable(4.5);
+    DoubleWritable d2 = new DoubleWritable(0.0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(d1),
+        new DeferredJavaObject(d2),
+    };
+
+    udf.initialize(inputOIs);
+    DoubleWritable d3 = (DoubleWritable) udf.evaluate(args);
+    Assert.assertNull(d3);
+  }
+
+  @Test
+  public void testModByZero8() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    // Decimal
+    HiveDecimalWritable dec1 = new HiveDecimalWritable(HiveDecimal.create("4.5"));
+    HiveDecimalWritable dec2 = new HiveDecimalWritable(HiveDecimal.create("0"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(2, 1)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(1, 0))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(dec1),
+        new DeferredJavaObject(dec2),
+    };
+
+    udf.initialize(inputOIs);
+    HiveDecimalWritable dec3 = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertNull(dec3);
+  }
+
+  @Test
+  public void testDecimalModDecimal() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(3, 1)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(4, 2), oi.getTypeInfo());
+  }
+
+  @Test
+  public void testDecimalModDecimalSameParams() throws HiveException {
+    GenericUDFOPMod udf = new GenericUDFOPMod();
+
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(5, 2), oi.getTypeInfo());
+  }
+
+}

Added: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java?rev=1543711&view=auto
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java (added)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java Wed Nov 20 05:40:46 2013
@@ -0,0 +1,203 @@
+/**
+ * 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.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.ByteWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.io.FloatWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestGenericUDFOPMultiply {
+
+  @Test
+  public void testByteTimesShort() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    ByteWritable left = new ByteWritable((byte) 4);
+    ShortWritable right = new ShortWritable((short) 6);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableByteObjectInspector,
+        PrimitiveObjectInspectorFactory.writableShortObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.shortTypeInfo);
+    ShortWritable res = (ShortWritable) udf.evaluate(args);
+    Assert.assertEquals(24, res.get());
+  }
+
+  @Test
+  public void testVarcharTimesInt() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    HiveVarcharWritable left = new HiveVarcharWritable();
+    left.set("123");
+    IntWritable right = new IntWritable(456);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableHiveVarcharObjectInspector,
+        PrimitiveObjectInspectorFactory.writableIntObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.doubleTypeInfo);
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(123 * 456), new Double(res.get()));
+  }
+
+  @Test
+  public void testDoubleTimesLong() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    DoubleWritable left = new DoubleWritable(4.5);
+    LongWritable right = new LongWritable(10);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.doubleTypeInfo, oi.getTypeInfo());
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(45.0), new Double(res.get()));
+  }
+
+  @Test
+  public void testLongTimesDecimal() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    LongWritable left = new LongWritable(104);
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector,
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(9, 4))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(29,4), oi.getTypeInfo());
+    HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertEquals(HiveDecimal.create("24436.88"), res.getHiveDecimal());
+  }
+
+  @Test
+  public void testFloatTimesFloat() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    FloatWritable f1 = new FloatWritable(4.5f);
+    FloatWritable f2 = new FloatWritable(0.0f);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector,
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(f1),
+        new DeferredJavaObject(f2),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.doubleTypeInfo);
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(0.0), new Double(res.get()));
+  }
+
+  @Test
+  public void testDouleTimesDecimal() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    DoubleWritable left = new DoubleWritable(74.52);
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.doubleTypeInfo, oi.getTypeInfo());
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(17509.9644), new Double(res.get()));
+  }
+
+  @Test
+  public void testDecimalTimesDecimal() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    HiveDecimalWritable left = new HiveDecimalWritable(HiveDecimal.create("14.5"));
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(3, 1)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(9,3), oi.getTypeInfo());
+    HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertEquals(HiveDecimal.create("3407.065"), res.getHiveDecimal());
+  }
+
+  @Test
+  public void testDecimalTimesDecimalSameParams() throws HiveException {
+    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();
+
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(11, 4), oi.getTypeInfo());
+  }
+
+}

Added: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java?rev=1543711&view=auto
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java (added)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java Wed Nov 20 05:40:46 2013
@@ -0,0 +1,210 @@
+/**
+ * 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.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.ByteWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.io.FloatWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestGenericUDFOPPlus {
+
+  @Test
+  public void testBytePlusShort() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    // Byte
+    ByteWritable left = new ByteWritable((byte) 4);
+    ShortWritable right = new ShortWritable((short) 6);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableByteObjectInspector,
+        PrimitiveObjectInspectorFactory.writableShortObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.shortTypeInfo);
+    ShortWritable res = (ShortWritable) udf.evaluate(args);
+    Assert.assertEquals(10, res.get());
+  }
+
+  @Test
+  public void testVarcharPlusInt() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    // Short
+    HiveVarcharWritable left = new HiveVarcharWritable();
+    left.set("123");
+    IntWritable right = new IntWritable(456);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableHiveVarcharObjectInspector,
+        PrimitiveObjectInspectorFactory.writableIntObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.doubleTypeInfo);
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(579.0), new Double(res.get()));
+  }
+
+  @Test
+  public void testDoublePlusLong() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    // Int
+    DoubleWritable left = new DoubleWritable(4.5);
+    LongWritable right = new LongWritable(10);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.doubleTypeInfo, oi.getTypeInfo());
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(14.5), new Double(res.get()));
+  }
+
+  @Test
+  public void testLongPlusDecimal() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    // Long
+    LongWritable left = new LongWritable(104);
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector,
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(9, 4))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(24,4), oi.getTypeInfo());
+    HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertEquals( HiveDecimal.create("338.97"), res.getHiveDecimal());
+  }
+
+  @Test
+  public void testFloatPlusFloat() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    // Float
+    FloatWritable f1 = new FloatWritable(4.5f);
+    FloatWritable f2 = new FloatWritable(0.0f);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector,
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(f1),
+        new DeferredJavaObject(f2),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.doubleTypeInfo);
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(4.5), new Double(res.get()));
+  }
+
+  @Test
+  public void testDoulePlusDecimal() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    // Double
+    DoubleWritable left = new DoubleWritable(74.52);
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.doubleTypeInfo, oi.getTypeInfo());
+    DoubleWritable res = (DoubleWritable) udf.evaluate(args);
+    Assert.assertEquals(new Double(309.49), new Double(res.get()));
+  }
+
+  @Test
+  public void testDecimalPlusDecimal() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    // Decimal
+    HiveDecimalWritable left = new HiveDecimalWritable(HiveDecimal.create("14.5"));
+    HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(3, 1)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(left),
+        new DeferredJavaObject(right),
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(6,2), oi.getTypeInfo());
+    HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertEquals(HiveDecimal.create("249.47"), res.getHiveDecimal());
+  }
+
+  @Test
+  public void testDecimalPlusDecimalSameParams() throws HiveException {
+    GenericUDFOPPlus udf = new GenericUDFOPPlus();
+
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(6, 2), oi.getTypeInfo());
+  }
+
+}

Added: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFPosMod.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFPosMod.java?rev=1543711&view=auto
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFPosMod.java (added)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFPosMod.java Wed Nov 20 05:40:46 2013
@@ -0,0 +1,214 @@
+/**
+ * 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.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.ByteWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.io.FloatWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestGenericUDFPosMod {
+
+  @Test
+  public void testPosModByZero1() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    // Byte
+    ByteWritable b1 = new ByteWritable((byte) 4);
+    ByteWritable b2 = new ByteWritable((byte) 0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableByteObjectInspector,
+        PrimitiveObjectInspectorFactory.writableByteObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(b1),
+        new DeferredJavaObject(b2),
+    };
+
+    udf.initialize(inputOIs);
+    ByteWritable b3 = (ByteWritable) udf.evaluate(args);
+    Assert.assertNull(b3);
+  }
+
+  @Test
+  public void testPosModByZero2() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    // Short
+    ShortWritable s1 = new ShortWritable((short) 4);
+    ShortWritable s2 = new ShortWritable((short) 0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableShortObjectInspector,
+        PrimitiveObjectInspectorFactory.writableShortObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(s1),
+        new DeferredJavaObject(s2),
+    };
+
+    udf.initialize(inputOIs);
+    ShortWritable s3 = (ShortWritable) udf.evaluate(args);
+    Assert.assertNull(s3);
+  }
+
+  @Test
+  public void testPosModByZero3() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    // Int
+    IntWritable i1 = new IntWritable(4);
+    IntWritable i2 = new IntWritable(0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableIntObjectInspector,
+        PrimitiveObjectInspectorFactory.writableIntObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(i1),
+        new DeferredJavaObject(i2),
+    };
+
+    udf.initialize(inputOIs);
+    IntWritable i3 = (IntWritable) udf.evaluate(args);
+    Assert.assertNull(i3);
+  }
+
+  @Test
+  public void testPosModByZero4() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    // Long
+    LongWritable l1 = new LongWritable(4);
+    LongWritable l2 = new LongWritable(0L);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector,
+        PrimitiveObjectInspectorFactory.writableLongObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(l1),
+        new DeferredJavaObject(l2),
+    };
+
+    udf.initialize(inputOIs);
+    LongWritable l3 = (LongWritable) udf.evaluate(args);
+    Assert.assertNull(l3);
+  }
+
+  @Test
+  public void testPosModByZero5() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    // Float
+    FloatWritable f1 = new FloatWritable(4.5f);
+    FloatWritable f2 = new FloatWritable(0.0f);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector,
+        PrimitiveObjectInspectorFactory.writableFloatObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(f1),
+        new DeferredJavaObject(f2),
+    };
+
+    udf.initialize(inputOIs);
+    FloatWritable f3 = (FloatWritable) udf.evaluate(args);
+    Assert.assertNull(f3);
+  }
+
+  @Test
+  public void testPosModByZero6() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    // Double
+    DoubleWritable d1 = new DoubleWritable(4.5);
+    DoubleWritable d2 = new DoubleWritable(0.0);
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
+        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(d1),
+        new DeferredJavaObject(d2),
+    };
+
+    udf.initialize(inputOIs);
+    DoubleWritable d3 = (DoubleWritable) udf.evaluate(args);
+    Assert.assertNull(d3);
+  }
+
+  @Test
+  public void testPosModByZero8() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    // Decimal
+    HiveDecimalWritable dec1 = new HiveDecimalWritable(HiveDecimal.create("4.5"));
+    HiveDecimalWritable dec2 = new HiveDecimalWritable(HiveDecimal.create("0"));
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(2, 1)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(1, 0))
+    };
+    DeferredObject[] args = {
+        new DeferredJavaObject(dec1),
+        new DeferredJavaObject(dec2),
+    };
+
+    udf.initialize(inputOIs);
+    HiveDecimalWritable dec3 = (HiveDecimalWritable) udf.evaluate(args);
+    Assert.assertNull(dec3);
+  }
+
+  @Test
+  public void testDecimalPosModDecimal() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(3, 1)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(5, 2), oi.getTypeInfo());
+  }
+
+  @Test
+  public void testDecimalPosModDecimalSameParams() throws HiveException {
+    GenericUDFPosMod udf = new GenericUDFPosMod();
+
+    ObjectInspector[] inputOIs = {
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2)),
+        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+    };
+
+    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
+    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(5, 2), oi.getTypeInfo());
+  }
+
+}

Modified: hive/trunk/ql/src/test/results/clientnegative/invalid_arithmetic_type.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/invalid_arithmetic_type.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/invalid_arithmetic_type.q.out (original)
+++ hive/trunk/ql/src/test/results/clientnegative/invalid_arithmetic_type.q.out Wed Nov 20 05:40:46 2013
@@ -1 +1 @@
-FAILED: SemanticException Line 0:-1 Wrong arguments ''2000-01-01 00:00:01'': No matching method for class org.apache.hadoop.hive.ql.udf.UDFOPMinus with (timestamp, timestamp)
+FAILED: SemanticException Line 0:-1 Wrong arguments ''2000-01-01 00:00:01'': No matching method for class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPMinus with (timestamp, timestamp)

Modified: hive/trunk/ql/src/test/results/clientnegative/udf_assert_true2.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/udf_assert_true2.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/udf_assert_true2.q.out (original)
+++ hive/trunk/ql/src/test/results/clientnegative/udf_assert_true2.q.out Wed Nov 20 05:40:46 2013
@@ -23,7 +23,7 @@ STAGE PLANS:
                   Select Operator
                     expressions:
                           expr: (1 + assert_true((_col4 < 2)))
-                          type: int
+                          type: double
                     outputColumnNames: _col0
                     Limit
                       File Output Operator
@@ -45,7 +45,7 @@ STAGE PLANS:
                     Select Operator
                       expressions:
                             expr: (1 + assert_true((_col4 < 2)))
-                            type: int
+                            type: double
                       outputColumnNames: _col0
                       Limit
                         File Output Operator

Modified: hive/trunk/ql/src/test/results/clientpositive/auto_join13.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/auto_join13.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/auto_join13.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/auto_join13.q.out Wed Nov 20 05:40:46 2013
@@ -78,7 +78,7 @@ STAGE PLANS:
                     1 
                   handleSkewJoin: false
                   keys:
-                    0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[_col0], Column[_col2]()]
+                    0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[_col0], Column[_col2]()]
                     1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[_col0]()]
                   Position of Big Table: 0
 
@@ -119,7 +119,7 @@ STAGE PLANS:
                       1 
                     handleSkewJoin: false
                     keys:
-                      0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[_col0], Column[_col2]()]
+                      0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[_col0], Column[_col2]()]
                       1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[_col0]()]
                     outputColumnNames: _col1, _col2
                     Position of Big Table: 0

Modified: hive/trunk/ql/src/test/results/clientpositive/auto_join2.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/auto_join2.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/auto_join2.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/auto_join2.q.out Wed Nov 20 05:40:46 2013
@@ -52,7 +52,7 @@ STAGE PLANS:
                 1 {value}
               handleSkewJoin: false
               keys:
-                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[_col0], Column[_col4]()]
+                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[_col0], Column[_col4]()]
                 1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key]()]
               Position of Big Table: 0
 
@@ -82,7 +82,7 @@ STAGE PLANS:
                   1 {value}
                 handleSkewJoin: false
                 keys:
-                  0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[_col0], Column[_col4]()]
+                  0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[_col0], Column[_col4]()]
                   1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key]()]
                 outputColumnNames: _col4, _col9
                 Position of Big Table: 0

Modified: hive/trunk/ql/src/test/results/clientpositive/bucketmapjoin_negative3.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/bucketmapjoin_negative3.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/bucketmapjoin_negative3.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/bucketmapjoin_negative3.q.out Wed Nov 20 05:40:46 2013
@@ -452,7 +452,7 @@ STAGE PLANS:
                 1 {key} {value}
               handleSkewJoin: false
               keys:
-                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key], Column[key]()]
+                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[key], Column[key]()]
                 1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key]()]
               Position of Big Table: 0
 
@@ -473,7 +473,7 @@ STAGE PLANS:
                 1 {key} {value}
               handleSkewJoin: false
               keys:
-                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key], Column[key]()]
+                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[key], Column[key]()]
                 1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key]()]
               outputColumnNames: _col0, _col1, _col4, _col5
               Position of Big Table: 0

Modified: hive/trunk/ql/src/test/results/clientpositive/decimal_6.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/decimal_6.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/decimal_6.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/decimal_6.q.out Wed Nov 20 05:40:46 2013
@@ -127,5 +127,5 @@ PREHOOK: query: desc DECIMAL_6_3
 PREHOOK: type: DESCTABLE
 POSTHOOK: query: desc DECIMAL_6_3
 POSTHOOK: type: DESCTABLE
-k                   	decimal(65,30)      	None                
+k                   	double              	None                
 v                   	int                 	None                

Modified: hive/trunk/ql/src/test/results/clientpositive/decimal_udf.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/decimal_udf.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/decimal_udf.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/decimal_udf.q.out Wed Nov 20 05:40:46 2013
@@ -254,7 +254,7 @@ STAGE PLANS:
           Select Operator
             expressions:
                   expr: (key + '1.0')
-                  type: decimal(65,30)
+                  type: double
             outputColumnNames: _col0
             ListSink
 
@@ -267,44 +267,44 @@ POSTHOOK: query: SELECT key + '1.0' FROM
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--4399
+-4399.0
 NULL
-1
-1
-101
-11
-2
+1.0
+1.0
+101.0
+11.0
+2.0
 1.1
 1.01
-201
-21
-3
-1
+201.0
+21.0
+3.0
+1.0
 1.2
 1.02
 1.3
 1.33
 1.333
 0.7
-0.67
+0.6699999999999999
 0.667
-2
-3
-4.14
--0.12
--0.12
--0.122
+2.0
+3.0
+4.140000000000001
+-0.1200000000000001
+-0.1200000000000001
+-0.12200000000000011
 2.12
 2.122
-125
+125.0
 126.2
 -1254.49
-4.14
-4.14
-4.14
-1.9999999999999999999999999
--1234567889.123456789
-1234567891.12345678
+4.140000000000001
+4.140000000000001
+4.140000000000001
+2.0
+-1.2345678891234567E9
+1.2345678911234567E9
 PREHOOK: query: -- substraction
 EXPLAIN SELECT key - key FROM DECIMAL_UDF
 PREHOOK: type: QUERY
@@ -540,7 +540,7 @@ STAGE PLANS:
           Select Operator
             expressions:
                   expr: (key - '1.0')
-                  type: decimal(65,30)
+                  type: double
             outputColumnNames: _col0
             ListSink
 
@@ -553,44 +553,44 @@ POSTHOOK: query: SELECT key - '1.0' FROM
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--4401
+-4401.0
 NULL
--1
--1
-99
-9
-0
+-1.0
+-1.0
+99.0
+9.0
+0.0
 -0.9
 -0.99
-199
-19
-1
--1
+199.0
+19.0
+1.0
+-1.0
 -0.8
 -0.98
 -0.7
--0.67
+-0.6699999999999999
 -0.667
 -1.3
 -1.33
 -1.333
-0
-1
+0.0
+1.0
 2.14
 -2.12
 -2.12
 -2.122
-0.12
-0.122
-123
+0.1200000000000001
+0.12200000000000011
+123.0
 124.2
 -1256.49
 2.14
 2.14
 2.14
--0.0000000000000000000000001
--1234567891.123456789
-1234567889.12345678
+0.0
+-1.2345678911234567E9
+1.2345678891234567E9
 PREHOOK: query: -- multiplication
 EXPLAIN SELECT key * key FROM DECIMAL_UDF
 PREHOOK: type: QUERY
@@ -826,7 +826,7 @@ STAGE PLANS:
           Select Operator
             expressions:
                   expr: (key * '2.0')
-                  type: decimal(65,30)
+                  type: double
             outputColumnNames: _col0
             ListSink
 
@@ -839,19 +839,19 @@ POSTHOOK: query: SELECT key * '2.0' FROM
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--8800
+-8800.0
 NULL
-0
-0
-200
-20
-2
+0.0
+0.0
+200.0
+20.0
+2.0
 0.2
 0.02
-400
-40
-4
-0
+400.0
+40.0
+4.0
+0.0
 0.4
 0.04
 0.6
@@ -860,23 +860,23 @@ NULL
 -0.6
 -0.66
 -0.666
-2
-4
+2.0
+4.0
 6.28
 -2.24
 -2.24
 -2.244
 2.24
 2.244
-248
+248.0
 250.4
 -2510.98
 6.28
 6.28
 6.28
-1.9999999999999999999999998
--2469135780.246913578
-2469135780.24691356
+2.0
+-2.4691357802469134E9
+2.4691357802469134E9
 PREHOOK: query: -- division
 EXPLAIN SELECT key / 0 FROM DECIMAL_UDF limit 1
 PREHOOK: type: QUERY
@@ -934,7 +934,7 @@ STAGE PLANS:
           Select Operator
             expressions:
                   expr: (key / null)
-                  type: decimal(65,30)
+                  type: double
             outputColumnNames: _col0
             Limit
               ListSink
@@ -1162,7 +1162,7 @@ STAGE PLANS:
           Select Operator
             expressions:
                   expr: (key / '2.0')
-                  type: decimal(65,30)
+                  type: double
             outputColumnNames: _col0
             ListSink
 
@@ -1175,19 +1175,19 @@ POSTHOOK: query: SELECT key / '2.0' FROM
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--2200
+-2200.0
 NULL
-0
-0
-50
-5
+0.0
+0.0
+50.0
+5.0
 0.5
 0.05
-0.005
-100
-10
-1
-0
+0.0050
+100.0
+10.0
+1.0
+0.0
 0.1
 0.01
 0.15
@@ -1197,22 +1197,22 @@ NULL
 -0.165
 -0.1665
 0.5
-1
+1.0
 1.57
 -0.56
 -0.56
 -0.561
 0.56
 0.561
-62
+62.0
 62.6
 -627.745
 1.57
 1.57
 1.57
-0.49999999999999999999999995
--617283945.0617283945
-617283945.06172839
+0.5
+-6.172839450617284E8
+6.172839450617284E8
 PREHOOK: query: -- abs
 EXPLAIN SELECT abs(key) FROM DECIMAL_UDF
 PREHOOK: type: QUERY

Modified: hive/trunk/ql/src/test/results/clientpositive/input8.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/input8.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/input8.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/input8.q.out Wed Nov 20 05:40:46 2013
@@ -34,10 +34,10 @@ STAGE PLANS:
             Select Operator
               expressions:
                     expr: (4 + null)
-                    type: int
+                    type: double
                     expr: UDFToInteger((key - null))
                     type: int
-                    expr: UDFToDouble((null + null))
+                    expr: (null + null)
                     type: double
               outputColumnNames: _col0, _col1, _col2
               File Output Operator

Modified: hive/trunk/ql/src/test/results/clientpositive/num_op_type_conv.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/num_op_type_conv.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/num_op_type_conv.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/num_op_type_conv.q.out Wed Nov 20 05:40:46 2013
@@ -24,11 +24,11 @@ STAGE PLANS:
           Select Operator
             expressions:
                   expr: (null + 7)
-                  type: int
+                  type: double
                   expr: (1.0 - null)
                   type: double
                   expr: (null + null)
-                  type: tinyint
+                  type: double
                   expr: (UDFToLong(21) % UDFToByte(5))
                   type: bigint
                   expr: (UDFToLong(21) % UDFToLong(21))

Modified: hive/trunk/ql/src/test/results/clientpositive/orc_createas1.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/orc_createas1.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/orc_createas1.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/orc_createas1.q.out Wed Nov 20 05:40:46 2013
@@ -288,7 +288,7 @@ STAGE PLANS:
                     type: int
                     expr: value
                     type: string
-                    expr: pmod(hash(key), 50)
+                    expr: (hash(key) pmod 50)
                     type: int
               outputColumnNames: _col0, _col1, _col2
               File Output Operator

Modified: hive/trunk/ql/src/test/results/clientpositive/ppd_constant_expr.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/ppd_constant_expr.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/ppd_constant_expr.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/ppd_constant_expr.q.out Wed Nov 20 05:40:46 2013
@@ -34,10 +34,10 @@ STAGE PLANS:
             Select Operator
               expressions:
                     expr: (4 + null)
-                    type: int
+                    type: double
                     expr: UDFToInteger((key - null))
                     type: int
-                    expr: UDFToDouble((null + null))
+                    expr: (null + null)
                     type: double
               outputColumnNames: _col0, _col1, _col2
               File Output Operator
@@ -189,10 +189,10 @@ STAGE PLANS:
             Select Operator
               expressions:
                     expr: (4 + null)
-                    type: int
+                    type: double
                     expr: UDFToInteger((key - null))
                     type: int
-                    expr: UDFToDouble((null + null))
+                    expr: (null + null)
                     type: double
               outputColumnNames: _col0, _col1, _col2
               File Output Operator

Modified: hive/trunk/ql/src/test/results/clientpositive/ql_rewrite_gbtoidx.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/ql_rewrite_gbtoidx.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/ql_rewrite_gbtoidx.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/ql_rewrite_gbtoidx.q.out Wed Nov 20 05:40:46 2013
@@ -1022,7 +1022,7 @@ STAGE PLANS:
                   expr: _col4
                   type: int
                   expr: ((_col5 - _col2) / _col2)
-                  type: double
+                  type: decimal(39,20)
             outputColumnNames: _col0, _col1, _col2
             File Output Operator
               compressed: false

Modified: hive/trunk/ql/src/test/results/clientpositive/rcfile_createas1.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/rcfile_createas1.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/rcfile_createas1.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/rcfile_createas1.q.out Wed Nov 20 05:40:46 2013
@@ -82,7 +82,7 @@ STAGE PLANS:
                     type: int
                     expr: value
                     type: string
-                    expr: pmod(hash(key), 50)
+                    expr: (hash(key) pmod 50)
                     type: int
               outputColumnNames: _col0, _col1, _col2
               File Output Operator

Modified: hive/trunk/ql/src/test/results/clientpositive/rcfile_merge1.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/rcfile_merge1.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/rcfile_merge1.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/rcfile_merge1.q.out Wed Nov 20 05:40:46 2013
@@ -58,7 +58,7 @@ STAGE PLANS:
                     type: int
                     expr: value
                     type: string
-                    expr: pmod(hash(key), 100)
+                    expr: (hash(key) pmod 100)
                     type: int
               outputColumnNames: _col0, _col1, _col2
               File Output Operator
@@ -672,7 +672,7 @@ STAGE PLANS:
                     type: int
                     expr: value
                     type: string
-                    expr: pmod(hash(key), 100)
+                    expr: (hash(key) pmod 100)
                     type: int
               outputColumnNames: _col0, _col1, _col2
               File Output Operator

Modified: hive/trunk/ql/src/test/results/clientpositive/rcfile_merge2.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/rcfile_merge2.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/rcfile_merge2.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/rcfile_merge2.q.out Wed Nov 20 05:40:46 2013
@@ -47,9 +47,9 @@ STAGE PLANS:
                     type: int
                     expr: value
                     type: string
-                    expr: pmod(hash(key), 10)
+                    expr: (hash(key) pmod 10)
                     type: int
-                    expr: pmod(hash(value), 10)
+                    expr: (hash(value) pmod 10)
                     type: int
               outputColumnNames: _col0, _col1, _col2, _col3
               File Output Operator

Modified: hive/trunk/ql/src/test/results/clientpositive/skewjoin.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/skewjoin.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/skewjoin.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/skewjoin.q.out Wed Nov 20 05:40:46 2013
@@ -1560,7 +1560,7 @@ STAGE PLANS:
                 1 {val}
               handleSkewJoin: false
               keys:
-                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key], Const int 1()]
+                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[key], Const int 1()]
                 1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key]()]
               Position of Big Table: 0
 
@@ -1578,7 +1578,7 @@ STAGE PLANS:
                 1 {val}
               handleSkewJoin: false
               keys:
-                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key], Const int 1()]
+                0 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPPlus(Column[key], Const int 1()]
                 1 [class org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge(Column[key]()]
               outputColumnNames: _col0, _col5
               Position of Big Table: 0

Modified: hive/trunk/ql/src/test/results/clientpositive/udf_case.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/udf_case.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/udf_case.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/udf_case.q.out Wed Nov 20 05:40:46 2013
@@ -210,4 +210,4 @@ FROM src tablesample (1 rows)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-123	123	abcd
+123	123.0	abcd

Modified: hive/trunk/ql/src/test/results/clientpositive/udf_pmod.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/udf_pmod.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/udf_pmod.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/udf_pmod.q.out Wed Nov 20 05:40:46 2013
@@ -76,7 +76,7 @@ POSTHOOK: query: SELECT pmod(CAST(-100.9
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-6.8899984	51.700005	18.089996
+6.889998435974121	51.70000457763672	18.089996337890625
 PREHOOK: query: SELECT pmod(CAST(-100.91 AS DOUBLE),CAST(9.8 AS DOUBLE)), pmod(CAST(-50.1 AS DOUBLE),CAST(101.8 AS DOUBLE)), pmod(CAST(-100.91 AS DOUBLE),CAST(29.75 AS DOUBLE)) FROM src tablesample (1 rows)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src

Modified: hive/trunk/ql/src/test/results/clientpositive/udf_when.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/udf_when.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/udf_when.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/udf_when.q.out Wed Nov 20 05:40:46 2013
@@ -193,4 +193,4 @@ FROM src tablesample (1 rows)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-123	123	abcd
+123	123.0	abcd

Modified: hive/trunk/ql/src/test/results/clientpositive/vectorization_15.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/vectorization_15.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/vectorization_15.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/vectorization_15.q.out Wed Nov 20 05:40:46 2013
@@ -77,32 +77,32 @@ NULL	true	10419.0	10	NULL	-721614386	NUL
 NULL	true	14519.0	100xJdkyc	NULL	729277608	NULL	NULL	-7.2927763428E8	14519.0	1155030.007	NULL	NULL	NULL	-23.0	NULL	0.0	NULL	NULL	7.2927763428E8	0.0
 -62.0	NULL	15601.0	NULL	-62	NULL	1969-12-31 16:00:09.889	0.0	NULL	15601.0	1241106.353	33.0	0.0	0.0	-23.0	62	NULL	NULL	-23	NULL	NULL
 -51.0	NULL	-200.0	NULL	-51	NULL	1969-12-31 15:59:55.423	0.0	NULL	-200.0	-15910.599999999999	33.0	0.0	0.0	-23.0	51	NULL	NULL	-23	NULL	NULL
--51.0	false	NULL	10	-51	1058319346	1969-12-31 16:00:08.451	0.0	-1.05831937228E9	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	1.05831942E9	-23	1.05831937228E9	0.0
--51.0	false	NULL	10TYIE5S35U6dj3N	-51	-469581869	1969-12-31 16:00:08.451	0.0	4.6958184272E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-4.69581792E8	-23	-4.6958184272E8	0.0
--51.0	false	NULL	1Lh6Uoq3WhNtOqQHu7WN7U	-51	-352637533	1969-12-31 16:00:08.451	0.0	3.5263750672E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-3.52637472E8	-23	-3.5263750672E8	0.0
--51.0	true	NULL	04Y1mA17	-51	-114647521	1969-12-31 16:00:08.451	0.0	1.1464749472E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-1.14647472E8	-23	-1.1464749472E8	0.0
+-51.0	false	NULL	10	-51	1058319346	1969-12-31 16:00:08.451	0.0	-1.05831937228E9	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	1.058319397E9	-23	1.05831937228E9	0.0
+-51.0	false	NULL	10TYIE5S35U6dj3N	-51	-469581869	1969-12-31 16:00:08.451	0.0	4.6958184272E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-4.69581818E8	-23	-4.6958184272E8	0.0
+-51.0	false	NULL	1Lh6Uoq3WhNtOqQHu7WN7U	-51	-352637533	1969-12-31 16:00:08.451	0.0	3.5263750672E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-3.52637482E8	-23	-3.5263750672E8	0.0
+-51.0	true	NULL	04Y1mA17	-51	-114647521	1969-12-31 16:00:08.451	0.0	1.1464749472E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-1.1464747E8	-23	-1.1464749472E8	0.0
 -51.0	true	NULL	10Wu570aLPO0p02P17FeH	-51	405338893	1969-12-31 16:00:08.451	0.0	-4.0533891928E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	4.05338944E8	-23	4.0533891928E8	0.0
 -51.0	true	NULL	3cQp060	-51	-226923315	1969-12-31 16:00:08.451	0.0	2.2692328872E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-2.26923264E8	-23	-2.2692328872E8	0.0
--51.0	true	NULL	8EPG0Xi307qd	-51	-328662044	1969-12-31 16:00:08.451	0.0	3.2866201772E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-3.28661984E8	-23	-3.2866201772E8	0.0
--51.0	true	NULL	8iHtdkJ6d	-51	1006818344	1969-12-31 16:00:08.451	0.0	-1.00681837028E9	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	1.00681843E9	-23	1.00681837028E9	0.0
--51.0	true	NULL	QiOcvR0kt6r7f0R7fiPxQTCU	-51	266531954	1969-12-31 16:00:08.451	0.0	-2.6653198028E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	2.66532E8	-23	2.6653198028E8	0.0
--51.0	true	NULL	Ybpj38RTTYl7CnJXPNx1g4C	-51	-370919370	1969-12-31 16:00:08.451	0.0	3.7091934372E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-3.70919296E8	-23	-3.7091934372E8	0.0
+-51.0	true	NULL	8EPG0Xi307qd	-51	-328662044	1969-12-31 16:00:08.451	0.0	3.2866201772E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-3.28661993E8	-23	-3.2866201772E8	0.0
+-51.0	true	NULL	8iHtdkJ6d	-51	1006818344	1969-12-31 16:00:08.451	0.0	-1.00681837028E9	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	1.006818395E9	-23	1.00681837028E9	0.0
+-51.0	true	NULL	QiOcvR0kt6r7f0R7fiPxQTCU	-51	266531954	1969-12-31 16:00:08.451	0.0	-2.6653198028E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	2.66532005E8	-23	2.6653198028E8	0.0
+-51.0	true	NULL	Ybpj38RTTYl7CnJXPNx1g4C	-51	-370919370	1969-12-31 16:00:08.451	0.0	3.7091934372E8	NULL	NULL	33.0	0.0	0.0	NULL	51	0.0	-3.70919319E8	-23	-3.7091934372E8	0.0
 -48.0	NULL	-7196.0	NULL	-48	NULL	1969-12-31 16:00:06.337	0.0	NULL	-7196.0	-572463.388	33.0	0.0	0.0	-23.0	48	NULL	NULL	-23	NULL	NULL
 -6.0	NULL	-200.0	NULL	-6	NULL	1969-12-31 15:59:56.094	0.0	NULL	-200.0	-15910.599999999999	3.0	0.0	0.0	-23.0	6	NULL	NULL	-5	NULL	NULL
 5.0	NULL	15601.0	NULL	5	NULL	1969-12-31 16:00:00.959	0.0	NULL	15601.0	1241106.353	3.0	0.0	0.0	-23.0	-5	NULL	NULL	-3	NULL	NULL
-8.0	false	NULL	10V3pN5r5lI2qWl2lG103	8	-362835731	1969-12-31 16:00:15.892	0.0	3.6283570472E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-3.62835744E8	-7	-3.6283570472E8	0.0
-8.0	false	NULL	10c4qt584m5y6uWT	8	-183000142	1969-12-31 16:00:15.892	0.0	1.8300011572E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-1.8300016E8	-7	-1.8300011572E8	0.0
+8.0	false	NULL	10V3pN5r5lI2qWl2lG103	8	-362835731	1969-12-31 16:00:15.892	0.0	3.6283570472E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-3.62835739E8	-7	-3.6283570472E8	0.0
+8.0	false	NULL	10c4qt584m5y6uWT	8	-183000142	1969-12-31 16:00:15.892	0.0	1.8300011572E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-1.8300015E8	-7	-1.8300011572E8	0.0
 8.0	false	NULL	8GloEukQ0c68JDmnYL53	8	-722873402	1969-12-31 16:00:15.892	0.0	7.2287337572E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-7.2287341E8	-7	-7.2287337572E8	0.0
 8.0	false	NULL	kA0XH5C5	8	-503903864	1969-12-31 16:00:15.892	0.0	5.0390383772E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-5.03903872E8	-7	-5.0390383772E8	0.0
-8.0	true	NULL	100VTM7PEW8GH1uE	8	88129338	1969-12-31 16:00:15.892	0.0	-8.812936428E7	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	8.8129328E7	-7	8.812936428E7	0.0
-8.0	true	NULL	1062158y	8	-1005155523	1969-12-31 16:00:15.892	0.0	1.00515549672E9	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-1.00515552E9	-7	-1.00515549672E9	0.0
-8.0	true	NULL	1063cEnGjSal	8	-624769630	1969-12-31 16:00:15.892	0.0	6.2476960372E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-6.247696E8	-7	-6.2476960372E8	0.0
-8.0	true	NULL	4kMasVoB7lX1wc5i64bNk	8	683567667	1969-12-31 16:00:15.892	0.0	-6.8356769328E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	6.8356768E8	-7	6.8356769328E8	0.0
-8.0	true	NULL	XH6I7A417	8	436627202	1969-12-31 16:00:15.892	0.0	-4.3662722828E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	4.366272E8	-7	4.3662722828E8	0.0
-11.0	false	NULL	10pO8p1LNx4Y	11	271296824	1969-12-31 16:00:02.351	0.0	-2.7129685028E8	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	2.71296832E8	-1	2.7129685028E8	0.0
-11.0	false	NULL	1H6wGP	11	-560827082	1969-12-31 16:00:02.351	0.0	5.6082705572E8	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	-5.6082707E8	-1	-5.6082705572E8	0.0
-11.0	false	NULL	2a7V63IL7jK3o	11	-325931647	1969-12-31 16:00:02.351	0.0	3.2593162072E8	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	-3.25931648E8	-1	-3.2593162072E8	0.0
-11.0	true	NULL	10	11	92365813	1969-12-31 16:00:02.351	0.0	-9.236583928E7	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	9.2365808E7	-1	9.236583928E7	0.0
+8.0	true	NULL	100VTM7PEW8GH1uE	8	88129338	1969-12-31 16:00:15.892	0.0	-8.812936428E7	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	8.812933E7	-7	8.812936428E7	0.0
+8.0	true	NULL	1062158y	8	-1005155523	1969-12-31 16:00:15.892	0.0	1.00515549672E9	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-1.005155531E9	-7	-1.00515549672E9	0.0
+8.0	true	NULL	1063cEnGjSal	8	-624769630	1969-12-31 16:00:15.892	0.0	6.2476960372E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	-6.24769638E8	-7	-6.2476960372E8	0.0
+8.0	true	NULL	4kMasVoB7lX1wc5i64bNk	8	683567667	1969-12-31 16:00:15.892	0.0	-6.8356769328E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	6.83567659E8	-7	6.8356769328E8	0.0
+8.0	true	NULL	XH6I7A417	8	436627202	1969-12-31 16:00:15.892	0.0	-4.3662722828E8	NULL	NULL	1.0	0.0	0.0	NULL	-8	0.0	4.36627194E8	-7	4.3662722828E8	0.0
+11.0	false	NULL	10pO8p1LNx4Y	11	271296824	1969-12-31 16:00:02.351	0.0	-2.7129685028E8	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	2.71296813E8	-1	2.7129685028E8	0.0
+11.0	false	NULL	1H6wGP	11	-560827082	1969-12-31 16:00:02.351	0.0	5.6082705572E8	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	-5.60827093E8	-1	-5.6082705572E8	0.0
+11.0	false	NULL	2a7V63IL7jK3o	11	-325931647	1969-12-31 16:00:02.351	0.0	3.2593162072E8	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	-3.25931658E8	-1	-3.2593162072E8	0.0
+11.0	true	NULL	10	11	92365813	1969-12-31 16:00:02.351	0.0	-9.236583928E7	NULL	NULL	0.0	0.0	0.0	NULL	-11	0.0	9.2365802E7	-1	9.236583928E7	0.0
 21.0	NULL	15601.0	NULL	21	NULL	1969-12-31 16:00:14.256	0.0	NULL	15601.0	1241106.353	12.0	0.0	0.0	-23.0	-21	NULL	NULL	-2	NULL	NULL
 32.0	NULL	-200.0	NULL	32	NULL	1969-12-31 16:00:02.445	0.0	NULL	-200.0	-15910.599999999999	1.0	0.0	0.0	-23.0	-32	NULL	NULL	-23	NULL	NULL
 36.0	NULL	-200.0	NULL	36	NULL	1969-12-31 16:00:00.554	0.0	NULL	-200.0	-15910.599999999999	33.0	0.0	0.0	-23.0	-36	NULL	NULL	-23	NULL	NULL

Modified: hive/trunk/ql/src/test/results/clientpositive/vectorization_5.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/vectorization_5.q.out?rev=1543711&r1=1543710&r2=1543711&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/vectorization_5.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/vectorization_5.q.out Wed Nov 20 05:40:46 2013
@@ -40,4 +40,4 @@ WHERE  (((cboolean2 IS NOT NULL)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-16343	-1225725	1070	-1145.53738317757	114090483	-16307	16307	197.0	-26853917571	11	-11	0
+16343	-1225725	1070	-1145.53738317757009345794	114090483	-16307	16307	NULL	-26853917571	11	-11	0