You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ch...@apache.org on 2014/09/12 20:55:22 UTC

svn commit: r1624611 - in /pig/trunk: CHANGES.txt src/org/apache/pig/newplan/logical/rules/ConstantCalculator.java

Author: cheolsoo
Date: Fri Sep 12 18:55:22 2014
New Revision: 1624611

URL: http://svn.apache.org/r1624611
Log:
PIG-4169: NPE in ConstantCalculator (cheolsoo)

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/newplan/logical/rules/ConstantCalculator.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1624611&r1=1624610&r2=1624611&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Fri Sep 12 18:55:22 2014
@@ -70,6 +70,8 @@ OPTIMIZATIONS
  
 BUG FIXES
 
+PIG-4169: NPE in ConstantCalculator (cheolsoo)
+
 PIG-4161: check for latest Hive snapshot dependencies (daijy)
 
 PIG-4102: Adding e2e tests and several improvements for Orc predicate pushdown (daijy)

Modified: pig/trunk/src/org/apache/pig/newplan/logical/rules/ConstantCalculator.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/rules/ConstantCalculator.java?rev=1624611&r1=1624610&r2=1624611&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/rules/ConstantCalculator.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/rules/ConstantCalculator.java Fri Sep 12 18:55:22 2014
@@ -27,6 +27,7 @@ import java.util.Map;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator;
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.Result;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan;
 import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.logicalLayer.FrontendException;
@@ -148,12 +149,15 @@ public abstract class ConstantCalculator
                     PhysicalOperator root = expPhysicalPlan.getLeaves().get(0);
                     try {
                         UDFContext.getUDFContext().addJobConf(ConfigurationUtil.toConfiguration(pc.getProperties(), true));
-                        val = root.getNext(root.getResultType()).result;
+                        Result ret= root.getNext(root.getResultType());
+                        if (ret.result != null) {
+                            val = ret.result;
+                            valSet = true;
+                        }
                         UDFContext.getUDFContext().addJobConf(null);
                     } catch (ExecException e) {
                         throw new FrontendException(e);
                     }
-                    valSet = true;
                 } else if (op instanceof UserFuncExpression) {
                     // If solo UDF, calculate UDF
                     UserFuncExpression udf = (UserFuncExpression)op;