You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2018/07/23 06:19:19 UTC

hive git commit: HIVE-20204: Type conversion during IN () comparisons is using different rules from other comparison operations (Jason Dere, reviewed by Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/master 68b129d4b -> cee099e65


HIVE-20204: Type conversion during IN () comparisons is using different rules from other comparison operations (Jason Dere, reviewed by Ashutosh Chauhan)


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

Branch: refs/heads/master
Commit: cee099e656110e7acde736205b57866887639b9d
Parents: 68b129d
Author: Jason Dere <jd...@hortonworks.com>
Authored: Sun Jul 22 23:18:35 2018 -0700
Committer: Jason Dere <jd...@hortonworks.com>
Committed: Sun Jul 22 23:18:35 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hive/ql/exec/FunctionRegistry.java   | 16 +++-
 .../calcite/translator/RexNodeConverter.java    |  2 +-
 .../hive/ql/udf/generic/GenericUDFIn.java       |  2 +-
 .../hive/ql/udf/generic/GenericUDFUtils.java    | 57 +++++++-------
 .../queries/clientpositive/orc_ppd_decimal.q    | 16 +++-
 .../clientpositive/parquet_ppd_decimal.q        | 16 +++-
 .../vectorization_parquet_ppd_decimal.q         | 16 +++-
 .../clientpositive/llap/orc_ppd_decimal.q.out   | 48 ++++++++++--
 .../clientpositive/parquet_ppd_decimal.q.out    | 80 +++++++++++++++++++-
 .../vectorization_parquet_ppd_decimal.q.out     | 80 +++++++++++++++++++-
 10 files changed, 281 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index 0800a10..3d5506f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hive.ql.exec;
 
 import java.lang.reflect.Method;
+import java.util.function.BiFunction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -808,9 +809,16 @@ public final class FunctionRegistry {
     if (a.equals(b)) {
       return a;
     }
+
     if (a.getCategory() != Category.PRIMITIVE || b.getCategory() != Category.PRIMITIVE) {
+      // It is not primitive; check if it is a struct and we can infer a common class
+      if (a.getCategory() == Category.STRUCT && b.getCategory() == Category.STRUCT) {
+        return getCommonClassForStruct((StructTypeInfo)a, (StructTypeInfo)b,
+            (type1, type2) -> getCommonClassForComparison(type1, type2));
+      }
       return null;
     }
+
     PrimitiveCategory pcA = ((PrimitiveTypeInfo)a).getPrimitiveCategory();
     PrimitiveCategory pcB = ((PrimitiveTypeInfo)b).getPrimitiveCategory();
 
@@ -943,7 +951,8 @@ public final class FunctionRegistry {
     }
     // It is not primitive; check if it is a struct and we can infer a common class
     if (a.getCategory() == Category.STRUCT && b.getCategory() == Category.STRUCT) {
-      return getCommonClassForStruct((StructTypeInfo)a, (StructTypeInfo)b);
+      return getCommonClassForStruct((StructTypeInfo)a, (StructTypeInfo)b,
+          (type1, type2) -> getCommonClass(type1, type2));
     }
     return null;
   }
@@ -954,7 +963,8 @@ public final class FunctionRegistry {
    *
    * @return null if no common class could be found.
    */
-  public static TypeInfo getCommonClassForStruct(StructTypeInfo a, StructTypeInfo b) {
+  public static TypeInfo getCommonClassForStruct(StructTypeInfo a, StructTypeInfo b,
+      BiFunction<TypeInfo, TypeInfo, TypeInfo> commonClassFunction) {
     if (a == b || a.equals(b)) {
       return a;
     }
@@ -983,7 +993,7 @@ public final class FunctionRegistry {
     ArrayList<TypeInfo> fromTypes = a.getAllStructFieldTypeInfos();
     ArrayList<TypeInfo> toTypes = b.getAllStructFieldTypeInfos();
     for (int i = 0; i < fromTypes.size(); i++) {
-      TypeInfo commonType = getCommonClass(fromTypes.get(i), toTypes.get(i));
+      TypeInfo commonType = commonClassFunction.apply(fromTypes.get(i), toTypes.get(i));
       if (commonType == null) {
         return null;
       }

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java
index 2ae015a..0a9ab2b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java
@@ -295,7 +295,7 @@ public class RexNodeConverter {
     for (int i =0; i < func.getChildren().size(); ++i) {
       ExprNodeDesc childExpr = func.getChildren().get(i);
       tmpExprNode = childExpr;
-      if (tgtDT != null
+      if (tgtDT != null && tgtDT.getCategory() == Category.PRIMITIVE
           && TypeInfoUtils.isConversionRequiredForComparison(tgtDT, childExpr.getTypeInfo())) {
         if (isCompare || isBetween || isIN) {
           // For compare, we will convert requisite children

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIn.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIn.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIn.java
index cf26fce..05e2647 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIn.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIn.java
@@ -86,7 +86,7 @@ public class GenericUDFIn extends GenericUDF {
     conversionHelper = new GenericUDFUtils.ReturnObjectInspectorResolver(true);
 
     for (ObjectInspector oi : arguments) {
-      if(!conversionHelper.update(oi)) {
+      if(!conversionHelper.updateForComparison(oi)) {
         StringBuilder sb = new StringBuilder();
         sb.append("The arguments for IN should be the same type! Types are: {");
         sb.append(arguments[0].getTypeName());

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUtils.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUtils.java
index c91865b..371de81 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUtils.java
@@ -81,6 +81,12 @@ public final class GenericUDFUtils {
    */
   public static class ReturnObjectInspectorResolver {
 
+    public enum ConversionType {
+      COMMON,
+      UNION,
+      COMPARISON
+    }
+
     boolean allowTypeConversion;
     ObjectInspector returnObjectInspector;
 
@@ -103,7 +109,7 @@ public final class GenericUDFUtils {
      * @return false if there is a type mismatch
      */
     public boolean update(ObjectInspector oi) throws UDFArgumentTypeException {
-      return update(oi, false);
+      return update(oi, ConversionType.COMMON);
     }
 
     /**
@@ -113,7 +119,17 @@ public final class GenericUDFUtils {
      * @return false if there is a type mismatch
      */
     public boolean updateForUnionAll(ObjectInspector oi) throws UDFArgumentTypeException {
-      return update(oi, true);
+      return update(oi, ConversionType.UNION);
+    }
+
+    /**
+     * Update returnObjectInspector and valueInspectorsAreTheSame based on the
+     * ObjectInspector seen for comparison (for example GenericUDFIn).
+     *
+     * @return false if there is a type mismatch
+     */
+    public boolean updateForComparison(ObjectInspector oi) throws UDFArgumentTypeException {
+      return update(oi, ConversionType.COMPARISON);
     }
 
     /**
@@ -122,7 +138,7 @@ public final class GenericUDFUtils {
      *
      * @return false if there is a type mismatch
      */
-    private boolean update(ObjectInspector oi, boolean isUnionAll) throws UDFArgumentTypeException {
+    private boolean update(ObjectInspector oi, ConversionType conversionType) throws UDFArgumentTypeException {
       if (oi instanceof VoidObjectInspector) {
         return true;
       }
@@ -161,18 +177,21 @@ public final class GenericUDFUtils {
       // Types are different, we need to check whether we can convert them to
       // a common base class or not.
       TypeInfo commonTypeInfo = null;
-      if (isUnionAll) {
+      switch (conversionType) {
+      case COMMON:
+        commonTypeInfo = FunctionRegistry.getCommonClass(oiTypeInfo, rTypeInfo);
+        break;
+      case UNION:
         commonTypeInfo = FunctionRegistry.getCommonClassForUnionAll(rTypeInfo, oiTypeInfo);
-      } else {
-        commonTypeInfo = FunctionRegistry.getCommonClass(oiTypeInfo,
-          rTypeInfo);
+        break;
+      case COMPARISON:
+        commonTypeInfo = FunctionRegistry.getCommonClassForComparison(rTypeInfo, oiTypeInfo);
+        break;
       }
       if (commonTypeInfo == null) {
         return false;
       }
 
-      commonTypeInfo = updateCommonTypeForDecimal(commonTypeInfo, oiTypeInfo, rTypeInfo);
-
       returnObjectInspector = TypeInfoUtils
           .getStandardWritableObjectInspectorFromTypeInfo(commonTypeInfo);
 
@@ -232,22 +251,6 @@ public final class GenericUDFUtils {
 
   }
 
-  protected static TypeInfo updateCommonTypeForDecimal(
-      TypeInfo commonTypeInfo, TypeInfo ti, TypeInfo returnType) {
-    /**
-     * TODO: Hack fix until HIVE-5848 is addressed. non-exact type shouldn't be promoted
-     * to exact type, as FunctionRegistry.getCommonClass() might do. This corrects
-     * that.
-     */
-    if (commonTypeInfo instanceof DecimalTypeInfo) {
-      if ((!FunctionRegistry.isExactNumericType((PrimitiveTypeInfo)ti)) ||
-          (!FunctionRegistry.isExactNumericType((PrimitiveTypeInfo)returnType))) {
-        return TypeInfoFactory.doubleTypeInfo;
-      }
-    }
-    return commonTypeInfo;
-  }
-
   // Based on update() above.
   public static TypeInfo deriveInType(List<ExprNodeDesc> children) {
     TypeInfo returnType = null;
@@ -262,9 +265,9 @@ public final class GenericUDFUtils {
         continue;
       }
       if (returnType == ti) continue;
-      TypeInfo commonTypeInfo = FunctionRegistry.getCommonClass(returnType, ti);
+      TypeInfo commonTypeInfo = FunctionRegistry.getCommonClassForComparison(returnType, ti);
       if (commonTypeInfo == null) return null;
-      returnType = updateCommonTypeForDecimal(commonTypeInfo, ti, returnType);
+      returnType = commonTypeInfo;
     }
     return returnType;
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/test/queries/clientpositive/orc_ppd_decimal.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/orc_ppd_decimal.q b/ql/src/test/queries/clientpositive/orc_ppd_decimal.q
index 2134a9f..d4affbb 100644
--- a/ql/src/test/queries/clientpositive/orc_ppd_decimal.q
+++ b/ql/src/test/queries/clientpositive/orc_ppd_decimal.q
@@ -130,10 +130,22 @@ set hive.optimize.index.filter=true;
 select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', 0.22);
 
 set hive.optimize.index.filter=false;
-select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', 0.22, cast('11.22' as float));
+select sum(hash(*)) from newtypesorc_n5 where d in (0.9, 0.22, 11.22);
 
 set hive.optimize.index.filter=true;
-select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', 0.22, cast('11.22' as float));
+select sum(hash(*)) from newtypesorc_n5 where d in (0.9, 0.22, 11.22);
+
+set hive.optimize.index.filter=false;
+select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', '0.22', '11.22');
+
+set hive.optimize.index.filter=true;
+select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', '0.22', '11.22');
+
+set hive.optimize.index.filter=false;
+select sum(hash(*)) from newtypesorc_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float));
+
+set hive.optimize.index.filter=true;
+select sum(hash(*)) from newtypesorc_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float));
 
 set hive.optimize.index.filter=false;
 select sum(hash(*)) from newtypesorc_n5 where d between 0 and 1;

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/test/queries/clientpositive/parquet_ppd_decimal.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/parquet_ppd_decimal.q b/ql/src/test/queries/clientpositive/parquet_ppd_decimal.q
index e8e118d..9593297 100644
--- a/ql/src/test/queries/clientpositive/parquet_ppd_decimal.q
+++ b/ql/src/test/queries/clientpositive/parquet_ppd_decimal.q
@@ -133,10 +133,22 @@ set hive.optimize.index.filter=true;
 select * from newtypestbl_n5 where d in ('0.9', 0.22);
 
 set hive.optimize.index.filter=false;
-select * from newtypestbl_n5 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c;
+select * from newtypestbl_n5 where d in (0.9, 0.22, 11.22) sort by c;
 
 set hive.optimize.index.filter=true;
-select * from newtypestbl_n5 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c;
+select * from newtypestbl_n5 where d in (0.9, 0.22, 11.22) sort by c;
+
+set hive.optimize.index.filter=false;
+select * from newtypestbl_n5 where d in ('0.9', '0.22', '11.22') sort by c;
+
+set hive.optimize.index.filter=true;
+select * from newtypestbl_n5 where d in ('0.9', '0.22', '11.22') sort by c;
+
+set hive.optimize.index.filter=false;
+select * from newtypestbl_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c;
+
+set hive.optimize.index.filter=true;
+select * from newtypestbl_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c;
 
 set hive.optimize.index.filter=false;
 select * from newtypestbl_n5 where d between 0 and 1;

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/test/queries/clientpositive/vectorization_parquet_ppd_decimal.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/vectorization_parquet_ppd_decimal.q b/ql/src/test/queries/clientpositive/vectorization_parquet_ppd_decimal.q
index 0b0811b..02f4739 100644
--- a/ql/src/test/queries/clientpositive/vectorization_parquet_ppd_decimal.q
+++ b/ql/src/test/queries/clientpositive/vectorization_parquet_ppd_decimal.q
@@ -133,10 +133,22 @@ set hive.optimize.index.filter=true;
 select * from newtypestbl_n1 where d in ('0.9', 0.22);
 
 set hive.optimize.index.filter=false;
-select * from newtypestbl_n1 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c;
+select * from newtypestbl_n1 where d in (0.9, 0.22, 11.22) sort by c;
 
 set hive.optimize.index.filter=true;
-select * from newtypestbl_n1 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c;
+select * from newtypestbl_n1 where d in (0.9, 0.22, 11.22) sort by c;
+
+set hive.optimize.index.filter=false;
+select * from newtypestbl_n1 where d in ('0.9', '0.22', '11.22') sort by c;
+
+set hive.optimize.index.filter=true;
+select * from newtypestbl_n1 where d in ('0.9', '0.22', '11.22') sort by c;
+
+set hive.optimize.index.filter=false;
+select * from newtypestbl_n1 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c;
+
+set hive.optimize.index.filter=true;
+select * from newtypestbl_n1 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c;
 
 set hive.optimize.index.filter=false;
 select * from newtypestbl_n1 where d between 0 and 1;

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/test/results/clientpositive/llap/orc_ppd_decimal.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/orc_ppd_decimal.q.out b/ql/src/test/results/clientpositive/llap/orc_ppd_decimal.q.out
index 4b535d4..b729b94 100644
--- a/ql/src/test/results/clientpositive/llap/orc_ppd_decimal.q.out
+++ b/ql/src/test/results/clientpositive/llap/orc_ppd_decimal.q.out
@@ -378,24 +378,60 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypesorc_n5
 #### A masked pattern was here ####
 -250934600000
-PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', 0.22, cast('11.22' as float))
+PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (0.9, 0.22, 11.22)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypesorc_n5
 #### A masked pattern was here ####
-POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', 0.22, cast('11.22' as float))
+POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (0.9, 0.22, 11.22)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypesorc_n5
 #### A masked pattern was here ####
--250934600000
-PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', 0.22, cast('11.22' as float))
+85510533500
+PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (0.9, 0.22, 11.22)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypesorc_n5
 #### A masked pattern was here ####
-POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', 0.22, cast('11.22' as float))
+POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (0.9, 0.22, 11.22)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypesorc_n5
 #### A masked pattern was here ####
--250934600000
+85510533500
+PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', '0.22', '11.22')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', '0.22', '11.22')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+85510533500
+PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', '0.22', '11.22')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in ('0.9', '0.22', '11.22')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+85510533500
+PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float))
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float))
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+85510533500
+PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float))
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float))
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc_n5
+#### A masked pattern was here ####
+85510533500
 PREHOOK: query: select sum(hash(*)) from newtypesorc_n5 where d between 0 and 1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypesorc_n5

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/test/results/clientpositive/parquet_ppd_decimal.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/parquet_ppd_decimal.q.out b/ql/src/test/results/clientpositive/parquet_ppd_decimal.q.out
index c9a4338..070e077 100644
--- a/ql/src/test/results/clientpositive/parquet_ppd_decimal.q.out
+++ b/ql/src/test/results/clientpositive/parquet_ppd_decimal.q.out
@@ -588,11 +588,11 @@ apple     	bee	0.220	1970-02-20
 apple     	bee	0.220	1970-02-20
 apple     	bee	0.220	1970-02-20
 apple     	bee	0.220	1970-02-20
-PREHOOK: query: select * from newtypestbl_n5 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+PREHOOK: query: select * from newtypestbl_n5 where d in (0.9, 0.22, 11.22) sort by c
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypestbl_n5
 #### A masked pattern was here ####
-POSTHOOK: query: select * from newtypestbl_n5 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+POSTHOOK: query: select * from newtypestbl_n5 where d in (0.9, 0.22, 11.22) sort by c
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypestbl_n5
 #### A masked pattern was here ####
@@ -606,11 +606,83 @@ hello     	world	11.220	1970-02-27
 hello     	world	11.220	1970-02-27
 hello     	world	11.220	1970-02-27
 hello     	world	11.220	1970-02-27
-PREHOOK: query: select * from newtypestbl_n5 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+PREHOOK: query: select * from newtypestbl_n5 where d in (0.9, 0.22, 11.22) sort by c
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypestbl_n5
 #### A masked pattern was here ####
-POSTHOOK: query: select * from newtypestbl_n5 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+POSTHOOK: query: select * from newtypestbl_n5 where d in (0.9, 0.22, 11.22) sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n5 where d in ('0.9', '0.22', '11.22') sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n5 where d in ('0.9', '0.22', '11.22') sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n5 where d in ('0.9', '0.22', '11.22') sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n5 where d in ('0.9', '0.22', '11.22') sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n5
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n5 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypestbl_n5
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/cee099e6/ql/src/test/results/clientpositive/vectorization_parquet_ppd_decimal.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vectorization_parquet_ppd_decimal.q.out b/ql/src/test/results/clientpositive/vectorization_parquet_ppd_decimal.q.out
index 49d7354..9cbed4f 100644
--- a/ql/src/test/results/clientpositive/vectorization_parquet_ppd_decimal.q.out
+++ b/ql/src/test/results/clientpositive/vectorization_parquet_ppd_decimal.q.out
@@ -588,11 +588,11 @@ apple     	bee	0.220	1970-02-20
 apple     	bee	0.220	1970-02-20
 apple     	bee	0.220	1970-02-20
 apple     	bee	0.220	1970-02-20
-PREHOOK: query: select * from newtypestbl_n1 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+PREHOOK: query: select * from newtypestbl_n1 where d in (0.9, 0.22, 11.22) sort by c
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypestbl_n1
 #### A masked pattern was here ####
-POSTHOOK: query: select * from newtypestbl_n1 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+POSTHOOK: query: select * from newtypestbl_n1 where d in (0.9, 0.22, 11.22) sort by c
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypestbl_n1
 #### A masked pattern was here ####
@@ -606,11 +606,83 @@ hello     	world	11.220	1970-02-27
 hello     	world	11.220	1970-02-27
 hello     	world	11.220	1970-02-27
 hello     	world	11.220	1970-02-27
-PREHOOK: query: select * from newtypestbl_n1 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+PREHOOK: query: select * from newtypestbl_n1 where d in (0.9, 0.22, 11.22) sort by c
 PREHOOK: type: QUERY
 PREHOOK: Input: default@newtypestbl_n1
 #### A masked pattern was here ####
-POSTHOOK: query: select * from newtypestbl_n1 where d in ('0.9', 0.22, cast('11.22' as float)) sort by c
+POSTHOOK: query: select * from newtypestbl_n1 where d in (0.9, 0.22, 11.22) sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n1 where d in ('0.9', '0.22', '11.22') sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n1 where d in ('0.9', '0.22', '11.22') sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n1 where d in ('0.9', '0.22', '11.22') sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n1 where d in ('0.9', '0.22', '11.22') sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n1 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n1 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+apple     	bee	0.220	1970-02-20
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+hello     	world	11.220	1970-02-27
+PREHOOK: query: select * from newtypestbl_n1 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypestbl_n1
+#### A masked pattern was here ####
+POSTHOOK: query: select * from newtypestbl_n1 where d in (cast('0.9' as float), cast('0.22' as float), cast('11.22' as float)) sort by c
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypestbl_n1
 #### A masked pattern was here ####