// set schemas
load1.setSchema(org.apache.pig.newplan.logical.Util.translateSchema(inputSchema1));
// create union operator
LODistinct distinct1 = new LODistinct(plan);
// wiring
plan.add(load1);
plan.add(distinct1);
plan.connect(load1, distinct1);
// validate
CompilationMessageCollector collector = new CompilationMessageCollector();
TypeCheckingRelVisitor typeChecker = new TypeCheckingRelVisitor(plan, collector);
typeChecker.visit();
printMessageCollector(collector);
// check end result schema
LogicalSchema outputSchema = distinct1.getSchema();
assertTrue(load1.getSchema().isEqual(outputSchema));
}