String inputFileName = f.getAbsolutePath();
// load as bytearray and use as map
planTester.buildPlan("a = load 'file://" + inputFileName + "' as (m);");
LogicalPlan lp = planTester.buildPlan("b = foreach a generate m#'k1';");
// validate
CompilationMessageCollector collector = new CompilationMessageCollector() ;
TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
typeValidator.validate(lp, collector) ;
// check that a LOCast has been introduced
LOForEach foreach = (LOForEach) lp.getLeaves().get(0);
LogicalPlan innerPlan = foreach.getForEachPlans().get(0);
LOMapLookup mapLookup = (LOMapLookup) innerPlan.getLeaves().get(0);
assertEquals(LOCast.class, mapLookup.getMap().getClass());
assertEquals(DataType.MAP, ((LOCast)mapLookup.getMap()).getType());
// load as map and use as map
planTester.buildPlan("a = load 'file://" + inputFileName + "' as (m:[]);");
lp = planTester.buildPlan("b = foreach a generate m#'k1';");
// validate
collector = new CompilationMessageCollector() ;
typeValidator = new TypeCheckingValidator() ;
typeValidator.validate(lp, collector) ;
// check that a LOCast has NOT been introduced
foreach = (LOForEach) lp.getLeaves().get(0);