int outputSchemaSize = exprPlans.get(0).size();
// by default, they are all bytearray
// for type checking, we don't care about aliases
for(int i=0; i<outputSchemaSize; i++) {
fsList.add(new LogicalFieldSchema(null, null, DataType.BYTEARRAY));
}
// merge all the inner plan outputs so we know what type
// our group column should be
for(int i=0;i < exprPlans.size(); i++) {
List<LogicalExpressionPlan> innerPlans =
new ArrayList<LogicalExpressionPlan>(exprPlans.get(i)) ;
for(int j=0;j < innerPlans.size(); j++) {
LogicalExpression eOp = (LogicalExpression)innerPlans.get(j).getSources().get(0);
byte innerType = eOp.getType();
if(eOp instanceof ProjectExpression) {
if(((ProjectExpression)eOp).isProjectStar()) {
//there is a project star and there is more than one
// expression plan
int errCode = 1013;
String msg = "Grouping attributes can either be star (*) " +
"or a list of expressions, but not both.";
msgCollector.collect(msg, MessageType.Error) ;
throw new FrontendException(
msg, errCode, PigException.INPUT, false, null
);
}
}
//merge the type
LogicalFieldSchema groupFs = fsList.get(j);
groupFs.type = DataType.mergeType(groupFs.type, innerType) ;
if(groupFs.type == DataType.ERROR){
String colType = "join";
if(op instanceof LOCogroup){
colType = "group";