// set schemas
load1.setScriptSchema(org.apache.pig.newplan.logical.Util.translateSchema(schema1));
load2.setScriptSchema(org.apache.pig.newplan.logical.Util.translateSchema(schema2));
LOCross cross = new LOCross(plan);
// wiring
plan.add(load1);
plan.add(load2);
plan.add(cross);
plan.connect(load1, cross);
plan.connect(load2, cross);
// validate
CompilationMessageCollector collector = new CompilationMessageCollector();
TypeCheckingRelVisitor typeChecker = new TypeCheckingRelVisitor(plan, collector);
typeChecker.visit();
printMessageCollector(collector);
//printTypeGraph(plan);
assertEquals(5, cross.getSchema().size());
assertEquals(DataType.INTEGER, cross.getSchema().getField(0).type);
assertEquals(DataType.LONG, cross.getSchema().getField(1).type);
assertEquals(DataType.BYTEARRAY, cross.getSchema().getField(2).type);
assertEquals(DataType.FLOAT, cross.getSchema().getField(3).type);
assertEquals(DataType.DOUBLE, cross.getSchema().getField(4).type);
}