hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1670781 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java test/results/clientpositive/annotate_stats_select.q.out
Date Wed, 01 Apr 2015 22:03:41 GMT
Author: hashutosh
Date: Wed Apr  1 22:03:41 2015
New Revision: 1670781

URL: http://svn.apache.org/r1670781
Log:
HIVE-10177 : Enable constant folding for char & varchar (Ashutosh Chauhan via Prashanth
J)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
    hive/trunk/ql/src/test/results/clientpositive/annotate_stats_select.q.out

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java?rev=1670781&r1=1670780&r2=1670781&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
Wed Apr  1 22:03:41 2015
@@ -517,15 +517,10 @@ public final class ConstantPropagateProc
       if (PrimitiveObjectInspectorUtils.isPrimitiveWritableClass(clz)) {
         PrimitiveObjectInspector poi = (PrimitiveObjectInspector) oi;
         TypeInfo typeInfo = poi.getTypeInfo();
-        // Handling parameterized types (varchar etc).
-        if (typeInfo.getTypeName().contains(serdeConstants.VARCHAR_TYPE_NAME)
-            || typeInfo.getTypeName().contains(serdeConstants.CHAR_TYPE_NAME)) {
-
-          // Do not support parameterized types.
-          return null;
-        }
         o = poi.getPrimitiveJavaObject(o);
-        if (typeInfo.getTypeName().contains(serdeConstants.DECIMAL_TYPE_NAME)) {
+        if (typeInfo.getTypeName().contains(serdeConstants.DECIMAL_TYPE_NAME) ||
+            typeInfo.getTypeName().contains(serdeConstants.VARCHAR_TYPE_NAME) ||
+            typeInfo.getTypeName().contains(serdeConstants.CHAR_TYPE_NAME)) {
           return new ExprNodeConstantDesc(typeInfo, o);
         }
       } else if (PrimitiveObjectInspectorUtils.isPrimitiveJavaClass(clz)) {

Modified: hive/trunk/ql/src/test/results/clientpositive/annotate_stats_select.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/annotate_stats_select.q.out?rev=1670781&r1=1670780&r2=1670781&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/annotate_stats_select.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/annotate_stats_select.q.out Wed Apr  1 22:03:41
2015
@@ -395,7 +395,7 @@ STAGE PLANS:
           alias: alltypes_orc
           Statistics: Num rows: 2 Data size: 1686 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: CAST( 'hello' AS CHAR(5) (type: char(5))
+            expressions: 'hello' (type: char(5))
             outputColumnNames: _col0
             Statistics: Num rows: 2 Data size: 178 Basic stats: COMPLETE Column stats: COMPLETE
             ListSink
@@ -416,7 +416,7 @@ STAGE PLANS:
           alias: alltypes_orc
           Statistics: Num rows: 2 Data size: 1686 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: CAST( 'hello' AS varchar(5)) (type: varchar(5))
+            expressions: 'hello' (type: varchar(5))
             outputColumnNames: _col0
             Statistics: Num rows: 2 Data size: 178 Basic stats: COMPLETE Column stats: COMPLETE
             ListSink



Mime
View raw message