PIG-5322: ConstantCalculator optimizer is not applied for split (rohini)

git-svn-id: https://svn.apache.org/repos/asf/pig/trunk@1819369 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 66ea6e6..d0dbde8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -26,6 +26,8 @@
  
 IMPROVEMENTS
 
+PIG-5322: ConstantCalculator optimizer is not applied for split (rohini)
+
 PIG-5316: Initialize mapred.task.id property for PoS jobs (nkollar via szita)
 
 PIG-5302: Remove HttpClient dependency (nkollar via szita)
diff --git a/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java b/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
index 7e5d7f6..1cc59e0 100644
--- a/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
+++ b/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
@@ -22,10 +22,6 @@
 import java.util.List;
 import java.util.Set;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.SetMultimap;
-import com.google.common.collect.TreeMultimap;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pig.impl.PigContext;
@@ -45,11 +41,16 @@
 import org.apache.pig.newplan.logical.rules.PredicatePushdownOptimizer;
 import org.apache.pig.newplan.logical.rules.PushDownForEachFlatten;
 import org.apache.pig.newplan.logical.rules.PushUpFilter;
+import org.apache.pig.newplan.logical.rules.SplitConstantCalculator;
 import org.apache.pig.newplan.logical.rules.SplitFilter;
 import org.apache.pig.newplan.logical.rules.StreamTypeCastInserter;
 import org.apache.pig.newplan.optimizer.PlanOptimizer;
 import org.apache.pig.newplan.optimizer.Rule;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.SetMultimap;
+import com.google.common.collect.TreeMultimap;
+
 public class LogicalPlanOptimizer extends PlanOptimizer {
     private static final Log LOG = LogFactory.getLog(LogicalPlanOptimizer.class);
     private static enum RulesReportKey { RULES_ENABLED, RULES_DISABLED }
@@ -89,10 +90,13 @@
         // Logical expression simplifier
         Set <Rule> s = new HashSet<Rule>();
         // add constant calculator rule
-        Rule r = new FilterConstantCalculator("ConstantCalculator", pc);
+        Rule r = new FilterConstantCalculator("FilterConstantCalculator", pc);
         checkAndAddRule(s, r);
         ls.add(s);
-        r = new ForEachConstantCalculator("ConstantCalculator", pc);
+        r = new ForEachConstantCalculator("ForEachConstantCalculator", pc);
+        checkAndAddRule(s, r);
+        ls.add(s);
+        r = new SplitConstantCalculator("SplitConstantCalculator", pc);
         checkAndAddRule(s, r);
         ls.add(s);
 
diff --git a/test/org/apache/pig/test/TestConstantCalculator.java b/test/org/apache/pig/test/TestConstantCalculator.java
index db20551..ef1a515 100644
--- a/test/org/apache/pig/test/TestConstantCalculator.java
+++ b/test/org/apache/pig/test/TestConstantCalculator.java
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
@@ -33,13 +34,20 @@
 import org.apache.pig.data.SchemaTupleBackend;
 import org.apache.pig.data.Tuple;
 import org.apache.pig.impl.PigContext;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
+import org.apache.pig.newplan.logical.expression.ConstantExpression;
+import org.apache.pig.newplan.logical.expression.NegativeExpression;
 import org.apache.pig.newplan.logical.optimizer.LogicalPlanOptimizer;
+import org.apache.pig.newplan.logical.relational.LOSplitOutput;
 import org.apache.pig.newplan.logical.relational.LogicalPlan;
 import org.apache.pig.newplan.logical.rules.FilterConstantCalculator;
 import org.apache.pig.newplan.logical.rules.ForEachConstantCalculator;
+import org.apache.pig.newplan.logical.rules.SplitConstantCalculator;
 import org.apache.pig.newplan.optimizer.PlanOptimizer;
 import org.apache.pig.newplan.optimizer.Rule;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -54,6 +62,7 @@
         SchemaTupleBackend.initialize(ConfigurationUtil.toConfiguration(pc.getProperties(), true),
                 pc);
     }
+
     @Test
     public void test() throws Exception {
         // pure simple constant
@@ -105,6 +114,36 @@
                 "store b into 'empty';");
     }
 
+    @Test
+    public void testSplit() throws Exception {
+        // calculation inside split
+        LogicalPlan plan = getOptimizedLogicalPlan("a = load 'd.txt' as (x:long);" +
+                "split a into b if x == -2L, c otherwise;" +
+                "store b into 'empty';" +
+                "store c into 'empty1';");
+
+        List<ConstantExpression> constantOps = new ArrayList<>();
+        Iterator<Operator> operators = plan.getOperators();
+        while (operators.hasNext()) {
+            Operator splitOp = operators.next();
+            if (splitOp instanceof LOSplitOutput) {
+                Iterator<Operator> splitOperators = ((LOSplitOutput)splitOp).getFilterPlan().getOperators();
+                while (splitOperators.hasNext()) {
+                    Operator op = splitOperators.next();
+                    if (op instanceof ConstantExpression) {
+                        constantOps.add((ConstantExpression)op);
+                    } else if (op instanceof NegativeExpression) {
+                        Assert.fail("Found NegativeExpression which should have been optimized");
+                    }
+                }
+            }
+
+        }
+       Assert.assertEquals(2, constantOps.size());
+       Assert.assertEquals(new Long(-2L), constantOps.get(0).getValue());
+       Assert.assertEquals(new Long(-2L), constantOps.get(1).getValue());
+    }
+
     public static class NoCalc extends EvalFunc<String> {
         @Override
         public String exec(Tuple input) throws IOException {
@@ -124,17 +163,23 @@
     }
 
     private void assertQuerySame(String origQuery, String optimizedQuery) throws Exception {
+        LogicalPlan newLogicalPlan = getOptimizedLogicalPlan(origQuery);
+
+        LogicalPlan expected = Util.buildLp(pigServer, optimizedQuery);
+
+        assertTrue(expected.isEqual(newLogicalPlan));
+
+    }
+
+    private LogicalPlan getOptimizedLogicalPlan(String origQuery)
+            throws Exception, IOException, FrontendException {
         LogicalPlan newLogicalPlan = Util.buildLp(pigServer, origQuery);
 
         SchemaTupleBackend.initialize(ConfigurationUtil.toConfiguration(pc.getProperties(), true),
                 pc);
         PlanOptimizer optimizer = new MyPlanOptimizer(newLogicalPlan, 10);
         optimizer.optimize();
-
-        LogicalPlan expected = Util.buildLp(pigServer, optimizedQuery);
-
-        assertTrue(expected.isEqual(newLogicalPlan));
-
+        return newLogicalPlan;
     }
 
     public class MyPlanOptimizer extends LogicalPlanOptimizer {
@@ -143,6 +188,7 @@
             super(p, iterations, null);
         }
 
+        @Override
         protected List<Set<Rule>> buildRuleSets() {
             List<Set<Rule>> ls = new ArrayList<Set<Rule>>();
 
@@ -154,6 +200,9 @@
             r = new ForEachConstantCalculator("ForEachConstantCalculator", pc);
             s.add(r);
             ls.add(s);
+            r = new SplitConstantCalculator("SplitConstantCalculator", pc);
+            s.add(r);
+            ls.add(s);
 
             return ls;
         }
diff --git a/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6-OPTOFF.gld b/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6-OPTOFF.gld
index 838623c..07b01de 100644
--- a/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6-OPTOFF.gld
+++ b/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6-OPTOFF.gld
@@ -4,122 +4,118 @@
 #--------------------------------------------------
 # TEZ DAG plan: pig-0_scope-0
 #--------------------------------------------------
-Tez vertex scope-48	->	Tez vertex scope-50,Tez vertex scope-53,
-Tez vertex scope-53	->	Tez vertex scope-56,Tez vertex scope-58,
-Tez vertex scope-50	->	Tez vertex scope-52,
-Tez vertex scope-52	->	Tez vertex scope-56,Tez vertex scope-58,
-Tez vertex scope-56
+Tez vertex scope-50	->	Tez vertex scope-52,Tez vertex scope-55,
+Tez vertex scope-55	->	Tez vertex scope-58,Tez vertex scope-60,
+Tez vertex scope-52	->	Tez vertex scope-54,
+Tez vertex scope-54	->	Tez vertex scope-58,Tez vertex scope-60,
 Tez vertex scope-58
+Tez vertex scope-60
 
-Tez vertex scope-48
-# Plan on vertex
-POValueOutputTez - scope-49	->	 [scope-50, scope-53]
-|
-|---a: New For Each(false,false)[bag] - scope-7
-    |   |
-    |   Cast[int] - scope-2
-    |   |
-    |   |---Project[bytearray][0] - scope-1
-    |   |
-    |   Cast[int] - scope-5
-    |   |
-    |   |---Project[bytearray][1] - scope-4
-    |
-    |---a: Load(file:///tmp/input:org.apache.pig.builtin.PigStorage) - scope-0
-Tez vertex scope-53
-# Plan on vertex
-POValueOutputTez - scope-55	->	 [scope-56, scope-58]
-|
-|---POValueInputTez - scope-54	<-	 scope-48
 Tez vertex scope-50
 # Plan on vertex
-b: Local Rearrange[tuple]{int}(false) - scope-72	->	 scope-52
-|   |
-|   Project[int][0] - scope-74
+POValueOutputTez - scope-51	->	 [scope-52, scope-55]
 |
-|---c: New For Each(false,false)[bag] - scope-61
+|---a: New For Each(false,false)[bag] - scope-11
     |   |
-    |   Project[int][0] - scope-62
+    |   Cast[int] - scope-6
     |   |
-    |   POUserFunc(org.apache.pig.builtin.COUNT$Initial)[tuple] - scope-63
+    |   |---Project[bytearray][0] - scope-5
     |   |
-    |   |---Project[bag][1] - scope-64
+    |   Cast[int] - scope-9
+    |   |
+    |   |---Project[bytearray][1] - scope-8
     |
-    |---Pre Combiner Local Rearrange[tuple]{Unknown} - scope-75
-        |
-        |---POValueInputTez - scope-51	<-	 scope-48
+    |---a: Load(file:///tmp/input:org.apache.pig.builtin.PigStorage) - scope-4
+Tez vertex scope-55
+# Plan on vertex
+POValueOutputTez - scope-57	->	 [scope-58, scope-60]
+|
+|---POValueInputTez - scope-56	<-	 scope-50
 Tez vertex scope-52
-# Combine plan on edge <scope-50>
-b: Local Rearrange[tuple]{int}(false) - scope-76	->	 scope-52
+# Plan on vertex
+b: Local Rearrange[tuple]{int}(false) - scope-74	->	 scope-54
 |   |
-|   Project[int][0] - scope-78
+|   Project[int][0] - scope-76
 |
-|---c: New For Each(false,false)[bag] - scope-65
+|---c: New For Each(false,false)[bag] - scope-63
     |   |
-    |   Project[int][0] - scope-66
+    |   Project[int][0] - scope-64
     |   |
-    |   POUserFunc(org.apache.pig.builtin.COUNT$Intermediate)[tuple] - scope-67
+    |   POUserFunc(org.apache.pig.builtin.COUNT$Initial)[tuple] - scope-65
     |   |
-    |   |---Project[bag][1] - scope-68
+    |   |---Project[bag][1] - scope-66
     |
-    |---b: Package(CombinerPackager)[tuple]{int} - scope-71
+    |---Pre Combiner Local Rearrange[tuple]{Unknown} - scope-77
+        |
+        |---POValueInputTez - scope-53	<-	 scope-50
+Tez vertex scope-54
+# Combine plan on edge <scope-52>
+b: Local Rearrange[tuple]{int}(false) - scope-78	->	 scope-54
+|   |
+|   Project[int][0] - scope-80
+|
+|---c: New For Each(false,false)[bag] - scope-67
+    |   |
+    |   Project[int][0] - scope-68
+    |   |
+    |   POUserFunc(org.apache.pig.builtin.COUNT$Intermediate)[tuple] - scope-69
+    |   |
+    |   |---Project[bag][1] - scope-70
+    |
+    |---b: Package(CombinerPackager)[tuple]{int} - scope-73
 # Plan on vertex
-POValueOutputTez - scope-60	->	 [scope-56, scope-58]
+POValueOutputTez - scope-62	->	 [scope-58, scope-60]
 |
-|---c: New For Each(false,false)[bag] - scope-23
+|---c: New For Each(false,false)[bag] - scope-27
     |   |
-    |   Project[int][0] - scope-18
+    |   Project[int][0] - scope-22
     |   |
-    |   POUserFunc(org.apache.pig.builtin.COUNT$Final)[long] - scope-21
+    |   POUserFunc(org.apache.pig.builtin.COUNT$Final)[long] - scope-25
     |   |
-    |   |---Project[bag][1] - scope-69
+    |   |---Project[bag][1] - scope-71
     |
-    |---b: Package(CombinerPackager)[tuple]{int} - scope-15
-Tez vertex scope-56
-# Plan on vertex
-d: Store(file:///tmp/pigoutput1:org.apache.pig.builtin.PigStorage) - scope-35
-|
-|---d: Filter[bag] - scope-25
-    |   |
-    |   Less Than[boolean] - scope-34
-    |   |
-    |   |---Multiply[long] - scope-31
-    |   |   |
-    |   |   |---Cast[long] - scope-27
-    |   |   |   |
-    |   |   |   |---Constant(2) - scope-26
-    |   |   |
-    |   |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-30
-    |   |       |
-    |   |       |---Constant(1) - scope-28
-    |   |
-    |   |---Cast[long] - scope-33
-    |       |
-    |       |---Project[int][1] - scope-32
-    |
-    |---POValueInputTez - scope-57	<-	 scope-53
+    |---b: Package(CombinerPackager)[tuple]{int} - scope-19
 Tez vertex scope-58
 # Plan on vertex
-e: Store(file:///tmp/pigoutput2:org.apache.pig.builtin.PigStorage) - scope-47
+d: Store(file:///tmp/pigoutput1:org.apache.pig.builtin.PigStorage) - scope-38
 |
-|---e: Filter[bag] - scope-36
+|---d: Filter[bag] - scope-29
     |   |
-    |   Not[boolean] - scope-46
+    |   Less Than[boolean] - scope-37
     |   |
-    |   |---Less Than[boolean] - scope-45
+    |   |---Multiply[long] - scope-34
+    |   |   |
+    |   |   |---Constant(2) - scope-30
+    |   |   |
+    |   |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-33
+    |   |       |
+    |   |       |---Constant(1) - scope-31
+    |   |
+    |   |---Cast[long] - scope-36
     |       |
-    |       |---Multiply[long] - scope-42
-    |       |   |
-    |       |   |---Cast[long] - scope-38
-    |       |   |   |
-    |       |   |   |---Constant(2) - scope-37
-    |       |   |
-    |       |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-41
-    |       |       |
-    |       |       |---Constant(1) - scope-39
-    |       |
-    |       |---Cast[long] - scope-44
-    |           |
-    |           |---Project[int][1] - scope-43
+    |       |---Project[int][1] - scope-35
     |
-    |---POValueInputTez - scope-59	<-	 scope-53
+    |---POValueInputTez - scope-59	<-	 scope-55
+Tez vertex scope-60
+# Plan on vertex
+e: Store(file:///tmp/pigoutput2:org.apache.pig.builtin.PigStorage) - scope-49
+|
+|---e: Filter[bag] - scope-39
+    |   |
+    |   Not[boolean] - scope-48
+    |   |
+    |   |---Less Than[boolean] - scope-47
+    |       |
+    |       |---Multiply[long] - scope-44
+    |       |   |
+    |       |   |---Constant(2) - scope-40
+    |       |   |
+    |       |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-43
+    |       |       |
+    |       |       |---Constant(1) - scope-41
+    |       |
+    |       |---Cast[long] - scope-46
+    |           |
+    |           |---Project[int][1] - scope-45
+    |
+    |---POValueInputTez - scope-61	<-	 scope-55
diff --git a/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6.gld b/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6.gld
index d5c3a8b..33769df 100644
--- a/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6.gld
+++ b/test/org/apache/pig/test/data/GoldenFiles/tez/TEZC-MQ-6.gld
@@ -4,118 +4,114 @@
 #--------------------------------------------------
 # TEZ DAG plan: pig-0_scope-0
 #--------------------------------------------------
-Tez vertex scope-48	->	Tez vertex scope-52,Tez vertex scope-53,
-Tez vertex scope-52	->	Tez vertex scope-53,Tez vertex scope-58,
-Tez vertex scope-53	->	Tez vertex scope-58,
-Tez vertex scope-58
+Tez vertex scope-50	->	Tez vertex scope-54,Tez vertex scope-55,
+Tez vertex scope-54	->	Tez vertex scope-55,Tez vertex scope-60,
+Tez vertex scope-55	->	Tez vertex scope-60,
+Tez vertex scope-60
 
-Tez vertex scope-48
+Tez vertex scope-50
 # Plan on vertex
-a: Split - scope-80
+a: Split - scope-82
 |   |
-|   b: Local Rearrange[tuple]{int}(false) - scope-72	->	 scope-52
+|   b: Local Rearrange[tuple]{int}(false) - scope-74	->	 scope-54
 |   |   |
-|   |   Project[int][0] - scope-74
+|   |   Project[int][0] - scope-76
 |   |
-|   |---c: New For Each(false,false)[bag] - scope-61
+|   |---c: New For Each(false,false)[bag] - scope-63
 |       |   |
-|       |   Project[int][0] - scope-62
+|       |   Project[int][0] - scope-64
 |       |   |
-|       |   POUserFunc(org.apache.pig.builtin.COUNT$Initial)[tuple] - scope-63
+|       |   POUserFunc(org.apache.pig.builtin.COUNT$Initial)[tuple] - scope-65
 |       |   |
-|       |   |---Project[bag][1] - scope-64
+|       |   |---Project[bag][1] - scope-66
 |       |
-|       |---Pre Combiner Local Rearrange[tuple]{Unknown} - scope-75
+|       |---Pre Combiner Local Rearrange[tuple]{Unknown} - scope-77
 |   |
-|   POValueOutputTez - scope-49	->	 [scope-53]
+|   POValueOutputTez - scope-51	->	 [scope-55]
 |
-|---a: New For Each(false,false)[bag] - scope-7
+|---a: New For Each(false,false)[bag] - scope-11
     |   |
-    |   Cast[int] - scope-2
+    |   Cast[int] - scope-6
     |   |
-    |   |---Project[bytearray][0] - scope-1
+    |   |---Project[bytearray][0] - scope-5
     |   |
-    |   Cast[int] - scope-5
+    |   Cast[int] - scope-9
     |   |
-    |   |---Project[bytearray][1] - scope-4
+    |   |---Project[bytearray][1] - scope-8
     |
-    |---a: Load(file:///tmp/input:org.apache.pig.builtin.PigStorage) - scope-0
-Tez vertex scope-52
-# Combine plan on edge <scope-48>
-b: Local Rearrange[tuple]{int}(false) - scope-76	->	 scope-52
+    |---a: Load(file:///tmp/input:org.apache.pig.builtin.PigStorage) - scope-4
+Tez vertex scope-54
+# Combine plan on edge <scope-50>
+b: Local Rearrange[tuple]{int}(false) - scope-78	->	 scope-54
 |   |
-|   Project[int][0] - scope-78
+|   Project[int][0] - scope-80
 |
-|---c: New For Each(false,false)[bag] - scope-65
+|---c: New For Each(false,false)[bag] - scope-67
     |   |
-    |   Project[int][0] - scope-66
+    |   Project[int][0] - scope-68
     |   |
-    |   POUserFunc(org.apache.pig.builtin.COUNT$Intermediate)[tuple] - scope-67
+    |   POUserFunc(org.apache.pig.builtin.COUNT$Intermediate)[tuple] - scope-69
     |   |
-    |   |---Project[bag][1] - scope-68
+    |   |---Project[bag][1] - scope-70
     |
-    |---b: Package(CombinerPackager)[tuple]{int} - scope-71
+    |---b: Package(CombinerPackager)[tuple]{int} - scope-73
 # Plan on vertex
-POValueOutputTez - scope-60	->	 [scope-53, scope-58]
+POValueOutputTez - scope-62	->	 [scope-55, scope-60]
 |
-|---c: New For Each(false,false)[bag] - scope-23
+|---c: New For Each(false,false)[bag] - scope-27
     |   |
-    |   Project[int][0] - scope-18
+    |   Project[int][0] - scope-22
     |   |
-    |   POUserFunc(org.apache.pig.builtin.COUNT$Final)[long] - scope-21
+    |   POUserFunc(org.apache.pig.builtin.COUNT$Final)[long] - scope-25
     |   |
-    |   |---Project[bag][1] - scope-69
+    |   |---Project[bag][1] - scope-71
     |
-    |---b: Package(CombinerPackager)[tuple]{int} - scope-15
-Tez vertex scope-53
+    |---b: Package(CombinerPackager)[tuple]{int} - scope-19
+Tez vertex scope-55
 # Plan on vertex
-1-1: Split - scope-79
+1-1: Split - scope-81
 |   |
-|   d: Store(file:///tmp/pigoutput1:org.apache.pig.builtin.PigStorage) - scope-35
+|   d: Store(file:///tmp/pigoutput1:org.apache.pig.builtin.PigStorage) - scope-38
 |   |
-|   |---d: Filter[bag] - scope-25
+|   |---d: Filter[bag] - scope-29
 |       |   |
-|       |   Less Than[boolean] - scope-34
+|       |   Less Than[boolean] - scope-37
 |       |   |
-|       |   |---Multiply[long] - scope-31
+|       |   |---Multiply[long] - scope-34
 |       |   |   |
-|       |   |   |---Cast[long] - scope-27
-|       |   |   |   |
-|       |   |   |   |---Constant(2) - scope-26
+|       |   |   |---Constant(2) - scope-30
 |       |   |   |
-|       |   |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-30
+|       |   |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-33
 |       |   |       |
-|       |   |       |---Constant(1) - scope-28
+|       |   |       |---Constant(1) - scope-31
 |       |   |
-|       |   |---Cast[long] - scope-33
+|       |   |---Cast[long] - scope-36
 |       |       |
-|       |       |---Project[int][1] - scope-32
+|       |       |---Project[int][1] - scope-35
 |   |
-|   POValueOutputTez - scope-55	->	 [scope-58]
+|   POValueOutputTez - scope-57	->	 [scope-60]
 |
-|---POValueInputTez - scope-54	<-	 scope-48
-Tez vertex scope-58
+|---POValueInputTez - scope-56	<-	 scope-50
+Tez vertex scope-60
 # Plan on vertex
-e: Store(file:///tmp/pigoutput2:org.apache.pig.builtin.PigStorage) - scope-47
+e: Store(file:///tmp/pigoutput2:org.apache.pig.builtin.PigStorage) - scope-49
 |
-|---e: Filter[bag] - scope-36
+|---e: Filter[bag] - scope-39
     |   |
-    |   Not[boolean] - scope-46
+    |   Not[boolean] - scope-48
     |   |
-    |   |---Less Than[boolean] - scope-45
+    |   |---Less Than[boolean] - scope-47
     |       |
-    |       |---Multiply[long] - scope-42
+    |       |---Multiply[long] - scope-44
     |       |   |
-    |       |   |---Cast[long] - scope-38
-    |       |   |   |
-    |       |   |   |---Constant(2) - scope-37
+    |       |   |---Constant(2) - scope-40
     |       |   |
-    |       |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-41
+    |       |   |---POUserFunc(org.apache.pig.backend.hadoop.executionengine.tez.plan.udf.ReadScalarsTez)[long] - scope-43
     |       |       |
-    |       |       |---Constant(1) - scope-39
+    |       |       |---Constant(1) - scope-41
     |       |
-    |       |---Cast[long] - scope-44
+    |       |---Cast[long] - scope-46
     |           |
-    |           |---Project[int][1] - scope-43
+    |           |---Project[int][1] - scope-45
     |
-    |---POValueInputTez - scope-59	<-	 scope-53
+    |---POValueInputTez - scope-61	<-	 scope-55