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 2014/10/21 00:49:21 UTC

svn commit: r1633250 - in /hive/branches/branch-0.14/ql/src: java/org/apache/hadoop/hive/ql/optimizer/ test/results/compiler/plan/

Author: hashutosh
Date: Mon Oct 20 22:49:20 2014
New Revision: 1633250

URL: http://svn.apache.org/r1633250
Log:
HIVE-8350 : Constant folding should happen before group-by optimization (Ashutosh Chauhan via Gunther Hagleitner)

Modified:
    hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
    hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GroupByOptimizer.java
    hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java
    hive/branches/branch-0.14/ql/src/test/results/compiler/plan/cast1.q.xml
    hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf1.q.xml
    hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf4.q.xml
    hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf6.q.xml
    hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_case.q.xml
    hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_when.q.xml

Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java (original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java Mon Oct 20 22:49:20 2014
@@ -29,6 +29,7 @@ import java.util.Stack;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.ql.exec.ColumnInfo;
 import org.apache.hadoop.hive.ql.exec.FileSinkOperator;
 import org.apache.hadoop.hive.ql.exec.FilterOperator;
@@ -710,6 +711,21 @@ public final class ConstantPropagateProc
       if (colList != null) {
         for (int i = 0; i < colList.size(); i++) {
           ExprNodeDesc newCol = foldExpr(colList.get(i), constants, cppCtx, op, 0, false);
+          if (!(colList.get(i) instanceof ExprNodeConstantDesc) && newCol instanceof ExprNodeConstantDesc) {
+            // Lets try to store original column name, if this column got folded
+            // This is useful for optimizations like GroupByOptimizer
+            String colName = colList.get(i).getExprString();
+            if (HiveConf.getPositionFromInternalName(colName) == -1) {
+              // if its not an internal name, this is what we want.
+              ((ExprNodeConstantDesc)newCol).setFoldedFromCol(colName);
+            } else {
+              // If it was internal column, lets try to get name from columnExprMap
+              ExprNodeDesc desc = columnExprMap.get(colName);
+              if (desc instanceof ExprNodeConstantDesc) {
+                ((ExprNodeConstantDesc)newCol).setFoldedFromCol(((ExprNodeConstantDesc)desc).getFoldedFromCol());
+              }
+            }
+          }
           colList.set(i, newCol);
           if (columnExprMap != null) {
             columnExprMap.put(columnNames.get(i), newCol);

Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GroupByOptimizer.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GroupByOptimizer.java?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GroupByOptimizer.java (original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GroupByOptimizer.java Mon Oct 20 22:49:20 2014
@@ -332,18 +332,26 @@ public class GroupByOptimizer implements
               continue;
             }
 
-            ExprNodeDesc selectColList = selectDesc.getColList().get(pos);
-            if (selectColList instanceof ExprNodeColumnDesc) {
+            ExprNodeDesc selectCol = selectDesc.getColList().get(pos);
+            if (selectCol instanceof ExprNodeColumnDesc) {
               String newValue =
-                  tableColsMapping.get(((ExprNodeColumnDesc) selectColList).getColumn());
+                  tableColsMapping.get(((ExprNodeColumnDesc) selectCol).getColumn());
               tableColsMapping.put(outputColumnName, newValue);
             }
             else {
               tableColsMapping.remove(outputColumnName);
-              if ((selectColList instanceof ExprNodeConstantDesc) ||
-                  (selectColList instanceof ExprNodeNullDesc)) {
+              if (selectCol instanceof ExprNodeNullDesc) {
                 newConstantCols.add(outputColumnName);
               }
+              if (selectCol instanceof ExprNodeConstantDesc) {
+                // Lets see if this constant was folded because of optimization.
+                String origCol = ((ExprNodeConstantDesc) selectCol).getFoldedFromCol();
+                if (origCol != null) {
+                  tableColsMapping.put(outputColumnName, origCol);
+                } else {
+                  newConstantCols.add(outputColumnName);
+                }
+              }
             }
           }
 
@@ -351,7 +359,6 @@ public class GroupByOptimizer implements
         }
       }
 
-      boolean sortGroupBy = true;
       // compute groupby columns from groupby keys
       List<String> groupByCols = new ArrayList<String>();
       // If the group by expression is anything other than a list of columns,

Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java (original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java Mon Oct 20 22:49:20 2014
@@ -70,13 +70,14 @@ public class Optimizer {
         transformations.add(new ListBucketingPruner());
       }
     }
+
+    if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEOPTCONSTANTPROPAGATION)) {
+      transformations.add(new ConstantPropagate());
+    }
     if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEOPTGROUPBY) ||
         HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_MAP_GROUPBY_SORT)) {
       transformations.add(new GroupByOptimizer());
     }
-    if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEOPTCONSTANTPROPAGATION)) {
-      transformations.add(new ConstantPropagate());
-    }
     transformations.add(new ColumnPruner());
     if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_OPTIMIZE_SKEWJOIN_COMPILETIME)) {
       transformations.add(new SkewJoinOptimizer());

Modified: hive/branches/branch-0.14/ql/src/test/results/compiler/plan/cast1.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/compiler/plan/cast1.q.xml?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/results/compiler/plan/cast1.q.xml (original)
+++ hive/branches/branch-0.14/ql/src/test/results/compiler/plan/cast1.q.xml Mon Oct 20 22:49:20 2014
@@ -379,6 +379,9 @@
                 <void method="put"> 
                  <string>_col6</string> 
                  <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>UDFToInteger(true)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -390,6 +393,9 @@
                 <void method="put"> 
                  <string>_col5</string> 
                  <object id="ExprNodeConstantDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>UDFToBoolean(1)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo2"/> 
                   </void> 
@@ -401,6 +407,9 @@
                 <void method="put"> 
                  <string>_col4</string> 
                  <object id="ExprNodeConstantDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(3 + UDFToInteger(2.0))</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -412,6 +421,9 @@
                 <void method="put"> 
                  <string>_col3</string> 
                  <object id="ExprNodeConstantDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(3.0 + 2.0)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
@@ -423,6 +435,9 @@
                 <void method="put"> 
                  <string>_col2</string> 
                  <object id="ExprNodeConstantDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(3 + 2.0)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
@@ -434,6 +449,9 @@
                 <void method="put"> 
                  <string>_col1</string> 
                  <object id="ExprNodeConstantDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(3.0 + 2)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
@@ -445,6 +463,9 @@
                 <void method="put"> 
                  <string>_col0</string> 
                  <object id="ExprNodeConstantDesc6" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(3 + 2)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 

Modified: hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf1.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf1.q.xml?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf1.q.xml (original)
+++ hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf1.q.xml Mon Oct 20 22:49:20 2014
@@ -535,6 +535,9 @@
                 <void method="put"> 
                  <string>_col8</string> 
                  <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;&apos; rlike &apos;.*&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -546,6 +549,9 @@
                 <void method="put"> 
                  <string>_col7</string> 
                  <object id="ExprNodeConstantDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;ab&apos; like &apos;a&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -557,6 +563,9 @@
                 <void method="put"> 
                  <string>_col6</string> 
                  <object id="ExprNodeConstantDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;ab&apos; like &apos;_a%&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -568,6 +577,9 @@
                 <void method="put"> 
                  <string>_col5</string> 
                  <object id="ExprNodeConstantDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;ab&apos; like &apos;\%\_&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -579,6 +591,9 @@
                 <void method="put"> 
                  <string>_col4</string> 
                  <object id="ExprNodeConstantDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;%_&apos; like &apos;\%\_&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -590,6 +605,9 @@
                 <void method="put"> 
                  <string>_col3</string> 
                  <object id="ExprNodeConstantDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;ab&apos; like &apos;%a_&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -601,6 +619,9 @@
                 <void method="put"> 
                  <string>_col2</string> 
                  <object id="ExprNodeConstantDesc6" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;ab&apos; like &apos;%a%&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -612,6 +633,9 @@
                 <void method="put"> 
                  <string>_col1</string> 
                  <object id="ExprNodeConstantDesc7" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;b&apos; like &apos;%a%&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -623,6 +647,9 @@
                 <void method="put"> 
                  <string>_col9</string> 
                  <object id="ExprNodeConstantDesc8" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;a&apos; rlike &apos;[ab]&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -634,6 +661,9 @@
                 <void method="put"> 
                  <string>_col13</string> 
                  <object id="ExprNodeConstantDesc9" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>regexp_replace(&apos;abc&apos;, &apos;b&apos;, &apos;c&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
@@ -645,6 +675,9 @@
                 <void method="put"> 
                  <string>_col12</string> 
                  <object id="ExprNodeConstantDesc10" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;hadoop&apos; rlike &apos;o*&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -656,6 +689,9 @@
                 <void method="put"> 
                  <string>_col11</string> 
                  <object id="ExprNodeConstantDesc11" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;hadoop&apos; rlike &apos;[a-z]*&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -667,6 +703,9 @@
                 <void method="put"> 
                  <string>_col10</string> 
                  <object id="ExprNodeConstantDesc12" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;&apos; rlike &apos;[ab]&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 
@@ -678,6 +717,9 @@
                 <void method="put"> 
                  <string>_col16</string> 
                  <object id="ExprNodeConstantDesc13" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>regexp_replace(&apos;hadoop&apos;, &apos;(.)[a-z]*&apos;, &apos;$1ive&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
@@ -689,6 +731,9 @@
                 <void method="put"> 
                  <string>_col15</string> 
                  <object id="ExprNodeConstantDesc14" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>regexp_replace(&apos;abbbb&apos;, &apos;bb&apos;, &apos;b&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
@@ -700,6 +745,9 @@
                 <void method="put"> 
                  <string>_col14</string> 
                  <object id="ExprNodeConstantDesc15" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>regexp_replace(&apos;abc&apos;, &apos;z&apos;, &apos;a&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
@@ -711,6 +759,9 @@
                 <void method="put"> 
                  <string>_col0</string> 
                  <object id="ExprNodeConstantDesc16" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+                  <void property="foldedFromCol"> 
+                   <string>(&apos;a&apos; like &apos;%a%&apos;)</string> 
+                  </void> 
                   <void property="typeInfo"> 
                    <object idref="PrimitiveTypeInfo0"/> 
                   </void> 

Modified: hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf4.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf4.q.xml?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf4.q.xml (original)
+++ hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf4.q.xml Mon Oct 20 22:49:20 2014
@@ -548,6 +548,9 @@
              <void method="put"> 
               <string>_col8</string> 
               <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>sqrt(0.0)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void> 
@@ -563,6 +566,9 @@
              <void method="put"> 
               <string>_col6</string> 
               <object id="ExprNodeConstantDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>sqrt(1.0)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void> 
@@ -574,6 +580,9 @@
              <void method="put"> 
               <string>_col5</string> 
               <object id="ExprNodeConstantDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>floor((- 1.5))</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo1"/> 
                </void> 
@@ -585,6 +594,9 @@
              <void method="put"> 
               <string>_col4</string> 
               <object id="ExprNodeConstantDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>floor(1.5)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo1"/> 
                </void> 
@@ -596,6 +608,9 @@
              <void method="put"> 
               <string>_col3</string> 
               <object id="ExprNodeConstantDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>floor(1.0)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo1"/> 
                </void> 
@@ -607,6 +622,9 @@
              <void method="put"> 
               <string>_col2</string> 
               <object id="ExprNodeConstantDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>round((- 1.5))</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void> 
@@ -618,6 +636,9 @@
              <void method="put"> 
               <string>_col1</string> 
               <object id="ExprNodeConstantDesc6" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>round(1.5)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void> 
@@ -629,6 +650,9 @@
              <void method="put"> 
               <string>_col9</string> 
               <object id="ExprNodeConstantDesc7" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>ceil(1.0)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo1"/> 
                </void> 
@@ -672,6 +696,9 @@
              <void method="put"> 
               <string>_col12</string> 
               <object id="ExprNodeConstantDesc8" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>ceil(1.0)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo1"/> 
                </void> 
@@ -683,6 +710,9 @@
              <void method="put"> 
               <string>_col11</string> 
               <object id="ExprNodeConstantDesc9" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>ceil((- 1.5))</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo1"/> 
                </void> 
@@ -694,6 +724,9 @@
              <void method="put"> 
               <string>_col10</string> 
               <object id="ExprNodeConstantDesc10" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>ceil(1.5)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo1"/> 
                </void> 
@@ -705,6 +738,9 @@
              <void method="put"> 
               <string>_col17</string> 
               <object id="ExprNodeConstantDesc11" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>(1 + (- 2))</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo2"/> 
                </void> 
@@ -716,6 +752,9 @@
              <void method="put"> 
               <string>_col16</string> 
               <object id="ExprNodeConstantDesc12" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>(1 + 2)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo2"/> 
                </void> 
@@ -727,6 +766,9 @@
              <void method="put"> 
               <string>_col15</string> 
               <object id="ExprNodeConstantDesc13" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>(- 3)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo2"/> 
                </void> 
@@ -749,6 +791,9 @@
              <void method="put"> 
               <string>_col0</string> 
               <object id="ExprNodeConstantDesc15" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>round(1.0)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void> 
@@ -760,6 +805,9 @@
              <void method="put"> 
               <string>_col18</string> 
               <object id="ExprNodeConstantDesc16" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>(~ 1)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo2"/> 
                </void> 

Modified: hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf6.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf6.q.xml?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf6.q.xml (original)
+++ hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf6.q.xml Mon Oct 20 22:49:20 2014
@@ -338,6 +338,9 @@
              <void method="put"> 
               <string>_col0</string> 
               <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>concat(&apos;a&apos;, &apos;b&apos;)</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void> 

Modified: hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_case.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_case.q.xml?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_case.q.xml (original)
+++ hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_case.q.xml Mon Oct 20 22:49:20 2014
@@ -351,6 +351,9 @@
              <void method="put"> 
               <string>_col0</string> 
               <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>CASE (1) WHEN (1) THEN (2) WHEN (3) THEN (4) ELSE (5) END</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void> 

Modified: hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_when.q.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_when.q.xml?rev=1633250&r1=1633249&r2=1633250&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_when.q.xml (original)
+++ hive/branches/branch-0.14/ql/src/test/results/compiler/plan/udf_when.q.xml Mon Oct 20 22:49:20 2014
@@ -351,6 +351,9 @@
              <void method="put"> 
               <string>_col0</string> 
               <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> 
+               <void property="foldedFromCol"> 
+                <string>CASE WHEN ((1 = 1)) THEN (2) WHEN ((3 = 5)) THEN (4) ELSE (5) END</string> 
+               </void> 
                <void property="typeInfo"> 
                 <object idref="PrimitiveTypeInfo0"/> 
                </void>