FAQ
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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedApr 1, '15 at 10:03p
activeApr 1, '15 at 10:03p
posts1
users1
websitehive.apache.org

1 user in discussion

Hashutosh: 1 post

People

Translate

site design / logo © 2022 Grokbase