schema = new LogicalSchema();
outputPlanSchemas = new ArrayList<LogicalSchema>();
for(int i=0; i<outputPlans.size(); i++) {
LogicalExpression exp = (LogicalExpression)outputPlans.get(i).getSources().get(0);
LogicalSchema mUserDefinedSchemaCopy = null;
if (mUserDefinedSchema!=null && mUserDefinedSchema.get(i)!=null) {
mUserDefinedSchemaCopy = new LogicalSchema();
for (LogicalSchema.LogicalFieldSchema fs : mUserDefinedSchema.get(i).getFields()) {
mUserDefinedSchemaCopy.addField(fs.deepCopy());
}
}
LogicalFieldSchema fieldSchema = null;
LogicalSchema expSchema = null;
if (exp.getFieldSchema()!=null) {
fieldSchema = exp.getFieldSchema().deepCopy();
expSchema = new LogicalSchema();
if (fieldSchema.type != DataType.TUPLE && fieldSchema.type != DataType.BAG) {
// if type is primitive, just add to schema
if (fieldSchema!=null)