org.apache.pig.experimental.logical.relational.LogicalPlan innerPlan =
forEach.getInnerPlan();
assertEquals( 1, innerPlan.getSinks().size() );
assertEquals( LOGenerate.class, innerPlan.getSinks().get(0).getClass() );
LOGenerate gen = (LOGenerate)innerPlan.getSinks().get(0);
assertEquals( 2, gen.getOutputPlans().size() );
LogicalExpressionPlan genExp1 = gen.getOutputPlans().get(0);
assertEquals( 1, genExp1.getSources().size() );
assertEquals( ProjectExpression.class, genExp1.getSources().get(0).getClass() );
ProjectExpression prj1 = (ProjectExpression) genExp1.getSources().get(0);
assertEquals( ls.getField(0).uid, prj1.getUid() );
LogicalExpressionPlan genExp2 = gen.getOutputPlans().get(1);
assertEquals( UserFuncExpression.class, genExp2.getSources().get(0).getClass() );
assertEquals( ProjectExpression.class, genExp2.getSinks().get(0).getClass() );
ProjectExpression prj2 = (ProjectExpression)genExp2.getSinks().get(0);
assertEquals( ls.getField(1).uid, prj2.getUid() );
assertEquals( BagDereferenceExpression.class, genExp2.getPredecessors(prj2).get(0).getClass() );