planTester.buildPlan("d = foreach c generate * ;") ;
planTester.buildPlan("f = foreach d generate group, flatten(a), flatten(b) ;") ;
LogicalPlan plan = planTester.buildPlan("g = foreach f generate group, field1 + 1, $4 + 2.0 ;") ;
// validate
CompilationMessageCollector collector = new CompilationMessageCollector() ;
TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
try {
typeValidator.validate(plan, collector) ;
}
catch (PlanValidationException pve) {
//not good
}
printMessageCollector(collector) ;
printTypeGraph(plan) ;
planTester.printPlan(plan, TypeCheckingTestUtil.getCurrentMethodName());
if (collector.hasError()) {
throw new AssertionError("Expect no error") ;
}
LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
LogicalPlan foreachPlan = foreach.getForEachPlans().get(1);