assertEquals(16, phyPlan.size());
assertEquals(phyPlan.getRoots().size(), 3);
assertEquals(phyPlan.getLeaves().size(), 1 );
// Check Load and LocalRearrange and GlobalRearrange
PhysicalOperator LoR = (PhysicalOperator)phyPlan.getSuccessors(phyPlan.getRoots().get(0)).get(0);
assertEquals( POLocalRearrange.class, LoR.getClass() );
POLocalRearrange Lor = (POLocalRearrange) LoR;
PhysicalOperator prj1 = Lor.getPlans().get(0).getLeaves().get(0);
assertEquals( POProject.class, prj1.getClass() );
assertEquals(0, ((POProject)prj1).getColumn() );
PhysicalOperator inp1 = Lor.getInputs().get(0);
assertEquals( POLoad.class, inp1.getClass() );
assertTrue( ((POLoad)inp1).getLFile().getFileName().contains("d3.txt") );
PhysicalOperator LoR1 = (PhysicalOperator)phyPlan.getSuccessors(phyPlan.getRoots().get(1)).get(0);
assertEquals( POLocalRearrange.class, LoR1.getClass() );
POLocalRearrange Lor1 = (POLocalRearrange) LoR1;
PhysicalOperator prj2 = Lor1.getPlans().get(0).getLeaves().get(0);
assertEquals( POProject.class, prj2.getClass() );
assertEquals(1, ((POProject)prj2).getColumn() );
PhysicalOperator inp2 = Lor1.getInputs().get(0);
assertEquals( POLoad.class, inp2.getClass() );
assertTrue( ((POLoad)inp2).getLFile().getFileName().contains("d2.txt") );
PhysicalOperator GoR = (PhysicalOperator)phyPlan.getSuccessors(LoR).get(0);
assertEquals( POGlobalRearrange.class, GoR.getClass() );
PhysicalOperator Pack = (PhysicalOperator)phyPlan.getSuccessors(GoR).get(0);
assertEquals( POPackage.class, Pack.getClass() );
PhysicalOperator LoR2 = (PhysicalOperator)phyPlan.getSuccessors(phyPlan.getRoots().get(2)).get(0);
assertEquals( POLocalRearrange.class, LoR2.getClass() );
POLocalRearrange Lor2 = (POLocalRearrange) LoR2;
PhysicalOperator prj3 = Lor2.getPlans().get(0).getLeaves().get(0);
assertEquals( POProject.class, prj3.getClass() );
assertEquals(0, ((POProject)prj3).getColumn() );
PhysicalOperator inp3 = Lor2.getInputs().get(0);
assertEquals( POLoad.class, inp3.getClass() );
assertTrue( ((POLoad)inp3).getLFile().getFileName().contains("d1.txt") );
PhysicalOperator GoR2 = (PhysicalOperator)phyPlan.getSuccessors(LoR2).get(0);
assertEquals( POGlobalRearrange.class, GoR2.getClass() );
PhysicalOperator Pack2 = (PhysicalOperator)phyPlan.getSuccessors(GoR2).get(0);
assertEquals( POPackage.class, Pack2.getClass() );
// Check for ForEach
PhysicalOperator ForE = (PhysicalOperator)phyPlan.getSuccessors(Pack).get(0);
assertEquals( POForEach.class, ForE.getClass() );
PhysicalOperator prj4 = ((POForEach)ForE).getInputPlans().get(0).getLeaves().get(0);
assertEquals( POProject.class, prj4.getClass() );
assertEquals( 1, ((POProject)prj4).getColumn() );
PhysicalOperator prj5 = ((POForEach)ForE).getInputPlans().get(1).getLeaves().get(0);
assertEquals( POProject.class, prj5.getClass() );
assertEquals( 2, ((POProject)prj5).getColumn() );
PhysicalOperator ForE2 = (PhysicalOperator)phyPlan.getSuccessors(Pack2).get(0);
assertEquals( POForEach.class, ForE2.getClass() );
PhysicalOperator prj6 = ((POForEach)ForE2).getInputPlans().get(0).getLeaves().get(0);
assertEquals( POProject.class, prj6.getClass() );
assertEquals( 1, ((POProject)prj6).getColumn() );
PhysicalOperator prj7 = ((POForEach)ForE2).getInputPlans().get(1).getLeaves().get(0);
assertEquals( POProject.class, prj7.getClass() );
assertEquals( 2, ((POProject)prj7).getColumn() );
// Check Filter Operator
PhysicalOperator fil = (PhysicalOperator)phyPlan.getSuccessors(ForE).get(0);
assertEquals( POFilter.class, fil.getClass() );
PhysicalPlan filPlan = ((POFilter)fil).getPlan();
List<PhysicalOperator> filRoots = filPlan.getRoots();
assertEquals( ConstantExpression.class, filRoots.get(0).getClass() );
ConstantExpression ce1 = (ConstantExpression) filRoots.get(0);
assertEquals( null, ce1.getValue() );
assertEquals( ConstantExpression.class, filRoots.get(2).getClass() );
ConstantExpression ce2 = (ConstantExpression) filRoots.get(2);
assertEquals( null, ce2.getValue() );
assertEquals( POProject.class, filRoots.get(1).getClass() );
POProject prj8 = (POProject) filRoots.get(1);
assertEquals( 5, prj8.getColumn() );
assertEquals( POProject.class, filRoots.get(3).getClass() );
POProject prj9 = (POProject) filRoots.get(3);
assertEquals( 2, prj9.getColumn() );
PhysicalOperator fil2 = (PhysicalOperator)phyPlan.getSuccessors(ForE2).get(0);
assertEquals( POFilter.class, fil2.getClass() );
PhysicalOperator LoR3 = (PhysicalOperator)phyPlan.getSuccessors(fil2).get(0);
assertEquals( POLocalRearrange.class, LoR3.getClass() );
POLocalRearrange Lor3 = (POLocalRearrange) LoR3;
PhysicalOperator prj12 = Lor3.getPlans().get(0).getLeaves().get(0);
assertEquals( POProject.class, prj12.getClass() );
assertEquals(3, ((POProject)prj12).getColumn() );
PhysicalPlan filPlan2 = ((POFilter)fil2).getPlan();
List<PhysicalOperator> filRoots2 = filPlan2.getRoots();
assertEquals( ConstantExpression.class, filRoots2.get(0).getClass() );
ConstantExpression ce3 = (ConstantExpression) filRoots2.get(0);
assertEquals( null, ce3.getValue() );
assertEquals( ConstantExpression.class, filRoots2.get(2).getClass() );
ConstantExpression ce4 = (ConstantExpression) filRoots2.get(2);
assertEquals( null, ce4.getValue() );
assertEquals( POProject.class, filRoots2.get(1).getClass() );
POProject prj10 = (POProject) filRoots2.get(1);
assertEquals( 3, prj10.getColumn() );
assertEquals( POProject.class, filRoots2.get(3).getClass() );
POProject prj11 = (POProject) filRoots2.get(3);
assertEquals( 0, prj11.getColumn() );
// Check Store Operator
PhysicalOperator stor = (PhysicalOperator)phyPlan.getLeaves().get(0);
assertEquals( stor, phyPlan.getSuccessors(fil).get(0));
assertEquals( POStore.class, stor.getClass() );
assertTrue( ((POStore)stor).getSFile().getFileName().contains("empty") );
}