You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2016/04/13 03:05:26 UTC

hive git commit: HIVE-13380 : Decimal should have lower precedence than double in type hierachy (Ashutosh Chauhan via Jason Dere)

Repository: hive
Updated Branches:
  refs/heads/master e16bcca64 -> b507520e1


HIVE-13380 : Decimal should have lower precedence than double in type hierachy (Ashutosh Chauhan via Jason Dere)

Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/b507520e
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b507520e
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b507520e

Branch: refs/heads/master
Commit: b507520e17811c8e059aa7d30490d29b984e2e96
Parents: e16bcca
Author: Ashutosh Chauhan <ha...@apache.org>
Authored: Tue Mar 29 18:14:43 2016 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Tue Apr 12 18:04:43 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/udf/UDFSign.java  | 15 +++++++++++
 .../hive/ql/exec/TestFunctionRegistry.java      | 26 ++++++++++----------
 .../ql/udf/generic/TestGenericUDFOPMinus.java   |  4 +--
 .../udf/generic/TestGenericUDFOPMultiply.java   |  4 +--
 .../ql/udf/generic/TestGenericUDFOPPlus.java    |  4 +--
 .../clientpositive/alter_partition_change_col.q |  1 +
 .../clientpositive/alter_table_cascade.q        |  1 +
 .../results/clientpositive/perf/query32.q.out   |  2 +-
 .../results/clientpositive/perf/query65.q.out   |  2 +-
 .../results/clientpositive/perf/query75.q.out   |  2 +-
 .../results/clientpositive/perf/query89.q.out   |  8 +++---
 .../tez/vector_decimal_expressions.q.out        |  2 +-
 .../results/clientpositive/udf_greatest.q.out   |  4 +--
 .../test/results/clientpositive/udf_least.q.out |  4 +--
 .../vector_decimal_expressions.q.out            |  2 +-
 .../hive/serde2/typeinfo/TypeInfoUtils.java     | 11 +++------
 16 files changed, 53 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSign.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSign.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSign.java
index 022b130..67d62d9 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSign.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSign.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncSignLongToDoubl
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
 import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
 
 @Description(name = "sign",
              value = "_FUNC_(x) - returns the sign of x )",
@@ -57,6 +58,20 @@ public class UDFSign extends UDF {
     return result;
   }
 
+  public DoubleWritable evaluate(LongWritable a) {
+    if (a == null) {
+      return null;
+    }
+    if (a.get() == 0) {
+      result.set(0);
+    } else if (a.get() > 0) {
+      result.set(1);
+    } else {
+      result.set(-1);
+    }
+    return result;
+  }
+
   /**
    * Get the sign of the decimal input
    *

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/org/apache/hadoop/hive/ql/exec/TestFunctionRegistry.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/exec/TestFunctionRegistry.java b/ql/src/test/org/apache/hadoop/hive/ql/exec/TestFunctionRegistry.java
index 8488c21..59ecd1e 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/exec/TestFunctionRegistry.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/exec/TestFunctionRegistry.java
@@ -23,12 +23,10 @@ import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 import org.apache.hadoop.hive.common.type.HiveVarchar;
 import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hadoop.hive.serde2.io.DateWritable;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
@@ -42,6 +40,7 @@ import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
+import org.junit.Assert;
 
 public class TestFunctionRegistry extends TestCase {
 
@@ -85,9 +84,10 @@ public class TestFunctionRegistry extends TestCase {
 
   public void testImplicitConversion() {
     implicit(TypeInfoFactory.intTypeInfo, TypeInfoFactory.decimalTypeInfo, true);
-    implicit(TypeInfoFactory.floatTypeInfo, TypeInfoFactory.decimalTypeInfo, true);
-    implicit(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.decimalTypeInfo, true);
-    implicit(TypeInfoFactory.stringTypeInfo, TypeInfoFactory.decimalTypeInfo, true);
+    implicit(TypeInfoFactory.longTypeInfo, TypeInfoFactory.decimalTypeInfo, true);
+    implicit(TypeInfoFactory.floatTypeInfo, TypeInfoFactory.decimalTypeInfo, false);
+    implicit(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.decimalTypeInfo, false);
+    implicit(TypeInfoFactory.stringTypeInfo, TypeInfoFactory.decimalTypeInfo, false);
     implicit(TypeInfoFactory.dateTypeInfo, TypeInfoFactory.decimalTypeInfo, false);
     implicit(TypeInfoFactory.timestampTypeInfo, TypeInfoFactory.decimalTypeInfo, false);
     implicit(varchar10, TypeInfoFactory.stringTypeInfo, true);
@@ -185,16 +185,16 @@ public class TestFunctionRegistry extends TestCase {
   public void testGetMethodInternal() {
 
     verify(TestUDF.class, "same", TypeInfoFactory.intTypeInfo, TypeInfoFactory.intTypeInfo,
-           DoubleWritable.class, DoubleWritable.class, false);
+           HiveDecimalWritable.class, HiveDecimalWritable.class, false);
 
     verify(TestUDF.class, "same", TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.doubleTypeInfo,
            DoubleWritable.class, DoubleWritable.class, false);
 
     verify(TestUDF.class, "same", TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.decimalTypeInfo,
-           HiveDecimalWritable.class, HiveDecimalWritable.class, false);
+           DoubleWritable.class, DoubleWritable.class, false);
 
     verify(TestUDF.class, "same", TypeInfoFactory.decimalTypeInfo, TypeInfoFactory.doubleTypeInfo,
-           HiveDecimalWritable.class, HiveDecimalWritable.class, false);
+           DoubleWritable.class, DoubleWritable.class, false);
 
     verify(TestUDF.class, "same", TypeInfoFactory.decimalTypeInfo, TypeInfoFactory.decimalTypeInfo,
            HiveDecimalWritable.class, HiveDecimalWritable.class, false);
@@ -226,7 +226,7 @@ public class TestFunctionRegistry extends TestCase {
     common(TypeInfoFactory.stringTypeInfo, TypeInfoFactory.decimalTypeInfo,
            TypeInfoFactory.stringTypeInfo);
     common(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.decimalTypeInfo,
-           TypeInfoFactory.decimalTypeInfo);
+           TypeInfoFactory.doubleTypeInfo);
     common(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.stringTypeInfo,
            TypeInfoFactory.stringTypeInfo);
 
@@ -246,9 +246,9 @@ public class TestFunctionRegistry extends TestCase {
     comparison(TypeInfoFactory.intTypeInfo, TypeInfoFactory.decimalTypeInfo,
                TypeInfoFactory.decimalTypeInfo);
     comparison(TypeInfoFactory.stringTypeInfo, TypeInfoFactory.decimalTypeInfo,
-               TypeInfoFactory.decimalTypeInfo);
+               TypeInfoFactory.doubleTypeInfo);
     comparison(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.decimalTypeInfo,
-               TypeInfoFactory.decimalTypeInfo);
+               TypeInfoFactory.doubleTypeInfo);
     comparison(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.stringTypeInfo,
                TypeInfoFactory.doubleTypeInfo);
 
@@ -330,9 +330,9 @@ public class TestFunctionRegistry extends TestCase {
     unionAll(TypeInfoFactory.intTypeInfo, TypeInfoFactory.decimalTypeInfo,
         TypeInfoFactory.decimalTypeInfo);
     unionAll(TypeInfoFactory.stringTypeInfo, TypeInfoFactory.decimalTypeInfo,
-        TypeInfoFactory.decimalTypeInfo);
+        TypeInfoFactory.stringTypeInfo);
     unionAll(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.decimalTypeInfo,
-        TypeInfoFactory.decimalTypeInfo);
+        TypeInfoFactory.doubleTypeInfo);
     unionAll(TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.stringTypeInfo,
         TypeInfoFactory.stringTypeInfo);
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java
index 771a6c7..b060877 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java
@@ -224,7 +224,7 @@ public class TestGenericUDFOPMinus extends AbstractTestGenericUDFOPNumeric {
 
     verifyReturnType(new GenericUDFOPMinus(), "float", "float", "float");
     verifyReturnType(new GenericUDFOPMinus(), "float", "double", "double");
-    verifyReturnType(new GenericUDFOPMinus(), "float", "decimal(10,2)", "double");
+    verifyReturnType(new GenericUDFOPMinus(), "float", "decimal(10,2)", "float");
 
     verifyReturnType(new GenericUDFOPMinus(), "double", "double", "double");
     verifyReturnType(new GenericUDFOPMinus(), "double", "decimal(10,2)", "double");
@@ -246,7 +246,7 @@ public class TestGenericUDFOPMinus extends AbstractTestGenericUDFOPNumeric {
 
     verifyReturnType(new GenericUDFOPMinus(), "float", "float", "float");
     verifyReturnType(new GenericUDFOPMinus(), "float", "double", "double");
-    verifyReturnType(new GenericUDFOPMinus(), "float", "decimal(10,2)", "double");
+    verifyReturnType(new GenericUDFOPMinus(), "float", "decimal(10,2)", "float");
 
     verifyReturnType(new GenericUDFOPMinus(), "double", "double", "double");
     verifyReturnType(new GenericUDFOPMinus(), "double", "decimal(10,2)", "double");

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
index 696682f..e342a76 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
@@ -215,7 +215,7 @@ public class TestGenericUDFOPMultiply extends AbstractTestGenericUDFOPNumeric {
 
     verifyReturnType(new GenericUDFOPMultiply(), "float", "float", "float");
     verifyReturnType(new GenericUDFOPMultiply(), "float", "double", "double");
-    verifyReturnType(new GenericUDFOPMultiply(), "float", "decimal(10,2)", "double");
+    verifyReturnType(new GenericUDFOPMultiply(), "float", "decimal(10,2)", "float");
 
     verifyReturnType(new GenericUDFOPMultiply(), "double", "double", "double");
     verifyReturnType(new GenericUDFOPMultiply(), "double", "decimal(10,2)", "double");
@@ -237,7 +237,7 @@ public class TestGenericUDFOPMultiply extends AbstractTestGenericUDFOPNumeric {
 
     verifyReturnType(new GenericUDFOPMultiply(), "float", "float", "float");
     verifyReturnType(new GenericUDFOPMultiply(), "float", "double", "double");
-    verifyReturnType(new GenericUDFOPMultiply(), "float", "decimal(10,2)", "double");
+    verifyReturnType(new GenericUDFOPMultiply(), "float", "decimal(10,2)", "float");
 
     verifyReturnType(new GenericUDFOPMultiply(), "double", "double", "double");
     verifyReturnType(new GenericUDFOPMultiply(), "double", "decimal(10,2)", "double");

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
index eba4894..b49f6ef 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
@@ -230,7 +230,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     verifyReturnType(new GenericUDFOPPlus(), "float", "float", "float");
     verifyReturnType(new GenericUDFOPPlus(), "float", "double", "double");
-    verifyReturnType(new GenericUDFOPPlus(), "float", "decimal(10,2)", "double");
+    verifyReturnType(new GenericUDFOPPlus(), "float", "decimal(10,2)", "float");
 
     verifyReturnType(new GenericUDFOPPlus(), "double", "double", "double");
     verifyReturnType(new GenericUDFOPPlus(), "double", "decimal(10,2)", "double");
@@ -252,7 +252,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     verifyReturnType(new GenericUDFOPPlus(), "float", "float", "float");
     verifyReturnType(new GenericUDFOPPlus(), "float", "double", "double");
-    verifyReturnType(new GenericUDFOPPlus(), "float", "decimal(10,2)", "double");
+    verifyReturnType(new GenericUDFOPPlus(), "float", "decimal(10,2)", "float");
 
     verifyReturnType(new GenericUDFOPPlus(), "double", "double", "double");
     verifyReturnType(new GenericUDFOPPlus(), "double", "decimal(10,2)", "double");

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/queries/clientpositive/alter_partition_change_col.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/alter_partition_change_col.q b/ql/src/test/queries/clientpositive/alter_partition_change_col.q
index 6861ca2..360f4d2 100644
--- a/ql/src/test/queries/clientpositive/alter_partition_change_col.q
+++ b/ql/src/test/queries/clientpositive/alter_partition_change_col.q
@@ -1,3 +1,4 @@
+set hive.metastore.disallow.incompatible.col.type.changes=false;
 SET hive.exec.dynamic.partition = true;
 SET hive.exec.dynamic.partition.mode = nonstrict;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/queries/clientpositive/alter_table_cascade.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/alter_table_cascade.q b/ql/src/test/queries/clientpositive/alter_table_cascade.q
index 479fda4..acca4e8 100644
--- a/ql/src/test/queries/clientpositive/alter_table_cascade.q
+++ b/ql/src/test/queries/clientpositive/alter_table_cascade.q
@@ -1,3 +1,4 @@
+set hive.metastore.disallow.incompatible.col.type.changes=false;
 SET hive.exec.dynamic.partition = true;
 SET hive.exec.dynamic.partition.mode = nonstrict;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/perf/query32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query32.q.out b/ql/src/test/results/clientpositive/perf/query32.q.out
index f9cfd69..7cfda2f 100644
--- a/ql/src/test/results/clientpositive/perf/query32.q.out
+++ b/ql/src/test/results/clientpositive/perf/query32.q.out
@@ -60,7 +60,7 @@ Stage-0
               Select Operator [SEL_32] (rows=169400 width=1436)
                 Output:["_col1"]
                 Filter Operator [FIL_31] (rows=169400 width=1436)
-                  predicate:(_col1 > CAST( _col5 AS decimal(20,15)))
+                  predicate:(UDFToDouble(_col1) > _col5)
                   Merge Join Operator [MERGEJOIN_59] (rows=508200 width=1436)
                     Conds:RS_27._col0=RS_28._col0(Inner),RS_28._col0=RS_29._col0(Inner),Output:["_col1","_col5"]
                   <-Map 6 [SIMPLE_EDGE]

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/perf/query65.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query65.q.out b/ql/src/test/results/clientpositive/perf/query65.q.out
index 9673373..15b2615 100644
--- a/ql/src/test/results/clientpositive/perf/query65.q.out
+++ b/ql/src/test/results/clientpositive/perf/query65.q.out
@@ -102,7 +102,7 @@ Stage-0
               Select Operator [SEL_49] (rows=372680 width=1436)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                 Filter Operator [FIL_48] (rows=372680 width=1436)
-                  predicate:(_col11 <= CAST( (0.1 * UDFToDouble(_col8)) AS decimal(30,15)))
+                  predicate:(UDFToDouble(_col11) <= (0.1 * UDFToDouble(_col8)))
                   Merge Join Operator [MERGEJOIN_73] (rows=1118040 width=1436)
                     Conds:RS_45._col7, _col0, _col2=RS_46._col0, _col0, _col1(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col8","_col11"]
                   <-Reducer 13 [SIMPLE_EDGE]

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/perf/query75.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query75.q.out b/ql/src/test/results/clientpositive/perf/query75.q.out
index 35729a2..15c46c2 100644
--- a/ql/src/test/results/clientpositive/perf/query75.q.out
+++ b/ql/src/test/results/clientpositive/perf/query75.q.out
@@ -43,7 +43,7 @@ Stage-0
               Select Operator [SEL_152] (rows=169103 width=1436)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
                 Filter Operator [FIL_151] (rows=169103 width=1436)
-                  predicate:((CAST( _col5 AS decimal(17,2)) / CAST( _col12 AS decimal(17,2))) < 0.9)
+                  predicate:(UDFToDouble((CAST( _col5 AS decimal(17,2)) / CAST( _col12 AS decimal(17,2)))) < 0.9)
                   Merge Join Operator [MERGEJOIN_259] (rows=507310 width=1436)
                     Conds:RS_148._col1, _col2, _col3, _col4=RS_149._col1, _col2, _col3, _col4(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col12","_col13"]
                   <-Reducer 31 [SIMPLE_EDGE]

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/perf/query89.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query89.q.out b/ql/src/test/results/clientpositive/perf/query89.q.out
index 165d829..75f7385 100644
--- a/ql/src/test/results/clientpositive/perf/query89.q.out
+++ b/ql/src/test/results/clientpositive/perf/query89.q.out
@@ -70,14 +70,14 @@ Stage-0
       File Output Operator [FS_36]
         Limit [LIM_35] (rows=100 width=1436)
           Number of rows:100
-          Select Operator [SEL_34] (rows=76865 width=1436)
+          Select Operator [SEL_34] (rows=51243 width=1436)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
           <-Reducer 6 [SIMPLE_EDGE]
             SHUFFLE [RS_33]
-              Select Operator [SEL_30] (rows=76865 width=1436)
+              Select Operator [SEL_30] (rows=51243 width=1436)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                Filter Operator [FIL_46] (rows=76865 width=1436)
-                  predicate:CASE WHEN ((avg_window_0 <> 0)) THEN (((abs((_col6 - avg_window_0)) / avg_window_0) > 0.1)) ELSE (null) END
+                Filter Operator [FIL_46] (rows=51243 width=1436)
+                  predicate:(UDFToDouble(CASE WHEN ((avg_window_0 <> 0)) THEN ((abs((_col6 - avg_window_0)) / avg_window_0)) ELSE (null) END) > 0.1)
                   Select Operator [SEL_29] (rows=153730 width=1436)
                     Output:["avg_window_0","_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
                     PTF Operator [PTF_28] (rows=153730 width=1436)

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out b/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
index 1b21c99..e5e5b4b 100644
--- a/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
+++ b/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
@@ -41,7 +41,7 @@ STAGE PLANS:
                   alias: decimal_test
                   Statistics: Num rows: 12288 Data size: 2128368 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((cdecimal1 > 0) and (cdecimal1 < 12345.5678) and (cdecimal2 <> 0) and (cdecimal2 > 1000) and cdouble is not null) (type: boolean)
+                    predicate: ((cdecimal1 > 0) and (UDFToDouble(cdecimal1) < 12345.5678) and (cdecimal2 <> 0) and (cdecimal2 > 1000) and cdouble is not null) (type: boolean)
                     Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: (cdecimal1 + cdecimal2) (type: decimal(25,14)), (cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), ((UDFToDouble(cdecimal1) + 2.34) / UDFToDouble(cdecimal2)) (type: double), (UDFToDouble(cdecimal1) * (UDFToDouble(cdecimal2) / 3.4)) (type: double), (cdecimal1 % 10) (type: decimal(12,10)), UDFToInteger(cdecimal1) (type: int), UDFToShort(cdecimal2) (type: smallint), UDFToByte(cdecimal2) (type: tinyint), UDFToLong(cdecimal1) (type: bigint), UDFToBoolean(cdecimal1) (type: boolean), UDFToDouble(cdecimal2) (type: double), UDFToFloat(cdecimal1) (type: float), UDFToString(cdecimal2) (type: string), CAST( cdecimal1 AS TIMESTAMP) (type: timestamp)

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/udf_greatest.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_greatest.q.out b/ql/src/test/results/clientpositive/udf_greatest.q.out
index 47cfb3f..7c7e67a 100644
--- a/ql/src/test/results/clientpositive/udf_greatest.q.out
+++ b/ql/src/test/results/clientpositive/udf_greatest.q.out
@@ -183,7 +183,7 @@ FROM src tablesample (1 rows)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-1.1	1.1	1	NULL
+1.100000023841858	1.1	1.0	NULL
 PREHOOK: query: SELECT GREATEST(-100Y, -80S, -60, -40L, cast(-20 as float), cast(0 as double), cast(0.5 as decimal)),
        GREATEST(100Y, 80S, 60, 40L, cast(20 as float), cast(0 as double), cast(-0.5 as decimal)),
        GREATEST(100Y, 80S, 60, 40L, null, cast(0 as double), cast(-0.5 as decimal))
@@ -198,7 +198,7 @@ FROM src tablesample (1 rows)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-1	100	NULL
+1.0	100.0	NULL
 PREHOOK: query: SELECT GREATEST(10L, 'a', date('2001-01-28'))
 FROM src tablesample (1 rows)
 PREHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/udf_least.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_least.q.out b/ql/src/test/results/clientpositive/udf_least.q.out
index 2363abe..497370e 100644
--- a/ql/src/test/results/clientpositive/udf_least.q.out
+++ b/ql/src/test/results/clientpositive/udf_least.q.out
@@ -183,7 +183,7 @@ FROM src tablesample (1 rows)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
--1.1	-1.1	-0.1	NULL
+-1.1	-1.100000023841858	-0.1	NULL
 PREHOOK: query: SELECT LEAST(-100Y, -80S, -60, -40L, cast(-20 as float), cast(0 as double), cast(0.5 as decimal)),
        LEAST(100Y, 80S, 60, 40L, cast(20 as float), cast(0 as double), cast(-0.5 as decimal)),
        LEAST(100Y, 80S, 60, 40L, null, cast(0 as double), cast(-0.5 as decimal))
@@ -198,7 +198,7 @@ FROM src tablesample (1 rows)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
--100	-1	NULL
+-100.0	-1.0	NULL
 PREHOOK: query: SELECT LEAST(10L, 'a', date('2001-01-28'))
 FROM src tablesample (1 rows)
 PREHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out b/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
index 03f6f35..9244efd 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
@@ -35,7 +35,7 @@ STAGE PLANS:
             alias: decimal_test
             Statistics: Num rows: 12288 Data size: 2128368 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((cdecimal1 > 0) and (cdecimal1 < 12345.5678) and (cdecimal2 <> 0) and (cdecimal2 > 1000) and cdouble is not null) (type: boolean)
+              predicate: ((cdecimal1 > 0) and (UDFToDouble(cdecimal1) < 12345.5678) and (cdecimal2 <> 0) and (cdecimal2 > 1000) and cdouble is not null) (type: boolean)
               Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: (cdecimal1 + cdecimal2) (type: decimal(25,14)), (cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), ((UDFToDouble(cdecimal1) + 2.34) / UDFToDouble(cdecimal2)) (type: double), (UDFToDouble(cdecimal1) * (UDFToDouble(cdecimal2) / 3.4)) (type: double), (cdecimal1 % 10) (type: decimal(12,10)), UDFToInteger(cdecimal1) (type: int), UDFToShort(cdecimal2) (type: smallint), UDFToByte(cdecimal2) (type: tinyint), UDFToLong(cdecimal1) (type: bigint), UDFToBoolean(cdecimal1) (type: boolean), UDFToDouble(cdecimal2) (type: double), UDFToFloat(cdecimal1) (type: float), UDFToString(cdecimal2) (type: string), CAST( cdecimal1 AS TIMESTAMP) (type: timestamp)

http://git-wip-us.apache.org/repos/asf/hive/blob/b507520e/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
index 16daecf..abd2838 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
@@ -68,9 +68,9 @@ public final class TypeInfoUtils {
     registerNumericType(PrimitiveCategory.SHORT, 2);
     registerNumericType(PrimitiveCategory.INT, 3);
     registerNumericType(PrimitiveCategory.LONG, 4);
-    registerNumericType(PrimitiveCategory.FLOAT, 5);
-    registerNumericType(PrimitiveCategory.DOUBLE, 6);
-    registerNumericType(PrimitiveCategory.DECIMAL, 7);
+    registerNumericType(PrimitiveCategory.DECIMAL, 5);
+    registerNumericType(PrimitiveCategory.FLOAT, 6);
+    registerNumericType(PrimitiveCategory.DOUBLE, 7);
     registerNumericType(PrimitiveCategory.STRING, 8);
   }
 
@@ -885,10 +885,7 @@ public final class TypeInfoUtils {
     if (fromPg == PrimitiveGrouping.STRING_GROUP && to == PrimitiveCategory.DOUBLE) {
       return true;
     }
-    // Allow implicit String to Decimal conversion
-    if (fromPg == PrimitiveGrouping.STRING_GROUP && to == PrimitiveCategory.DECIMAL) {
-      return true;
-    }
+
     // Void can be converted to any type
     if (from == PrimitiveCategory.VOID) {
       return true;