LogicalPlan innerRelPlan = new LogicalPlan();
LOForEach foreach1 = new LOForEach(plan);
foreach1.setInnerPlan(innerRelPlan);
LOGenerate loGen = new LOGenerate(innerRelPlan);
innerRelPlan.add(loGen);
LOInnerLoad innerLoad1 = new LOInnerLoad(innerRelPlan, foreach1, 0);
innerRelPlan.add(innerLoad1);
innerRelPlan.connect(innerLoad1, loGen);
// Create expression inner plan #1
LogicalExpressionPlan innerPlan1 = new LogicalExpressionPlan();
ProjectExpression project11 = new ProjectExpression(innerPlan1, 0, 0, loGen);
ConstantExpression const11 = new ConstantExpression(innerPlan1, 26F);
SubtractExpression subtract11 = new SubtractExpression(innerPlan1, project11, const11);
// Create expression inner plan #2
LogicalExpressionPlan innerPlan2 = new LogicalExpressionPlan();
LOInnerLoad innerLoad2 = new LOInnerLoad(innerRelPlan, foreach1, 0);
innerRelPlan.add(innerLoad2);
innerRelPlan.connect(innerLoad2, loGen);
ProjectExpression project21 = new ProjectExpression(innerPlan2, 1, 0, loGen);
LOInnerLoad innerLoad3 = new LOInnerLoad(innerRelPlan, foreach1, 1);
innerRelPlan.add(innerLoad3);
innerRelPlan.connect(innerLoad3, loGen);
ProjectExpression project22 = new ProjectExpression(innerPlan2, 2, 0, loGen);
AddExpression add21 = new AddExpression(innerPlan2, project21, project22 );
// List of plans
ArrayList<LogicalExpressionPlan> generatePlans = new ArrayList<LogicalExpressionPlan>();
generatePlans.add(innerPlan1);
generatePlans.add(innerPlan2);
// List of flatten flags
boolean [] flattens = {true, false};
loGen.setFlattenFlags(flattens);
loGen.setOutputPlans(generatePlans);
// construct the main plan
plan.add(load1);
plan.add(foreach1);