validateAlias(innerField.alias);
}
if(howlField != null){
// Do the same validation for HowlSchema.
HowlFieldSchema arrayFieldScehma = howlField.getArrayElementSchema().get(0);
Type hType = arrayFieldScehma.getType();
if(hType == Type.STRUCT){
for(HowlFieldSchema structFieldInBag : arrayFieldScehma.getStructSubSchema().getFields()){
if(structFieldInBag.getType() == Type.STRUCT || structFieldInBag.getType() == Type.ARRAY){
throw new FrontendException("Nested Complex types not allowed "+ howlField, PigHowlUtil.PIG_EXCEPTION_CODE);
}
}
}
if(hType == Type.MAP){
if(arrayFieldScehma.getMapKeyType() != Type.STRING){
throw new FrontendException("Key Type of map must be String "+howlField, PigHowlUtil.PIG_EXCEPTION_CODE);
}
if(arrayFieldScehma.getMapValueSchema().get(0).isComplex()){
throw new FrontendException("Value type of map cannot be complex "+howlField, PigHowlUtil.PIG_EXCEPTION_CODE);
}
}
if(hType == Type.ARRAY) {
throw new FrontendException("Arrays cannot contain array within it. "+howlField, PigHowlUtil.PIG_EXCEPTION_CODE);
}
}
break;
case DataType.TUPLE:
validateUnNested(pigField.schema);
if(howlField != null){
for(HowlFieldSchema structFieldSchema : howlField.getStructSubSchema().getFields()){
if(structFieldSchema.isComplex()){
throw new FrontendException("Nested Complex types are not allowed."+howlField, PigHowlUtil.PIG_EXCEPTION_CODE);
}
}
}
break;
default:
throw new FrontendException("Internal Error.", PigHowlUtil.PIG_EXCEPTION_CODE);
}
}
}
for(HowlFieldSchema howlField : tblSchema.getFields()){
// We dont do type promotion/demotion.
Type hType = howlField.getType();
switch(hType){
case SMALLINT:
case TINYINT:
case BOOLEAN:
throw new FrontendException("Incompatible type found in howl table schema: "+howlField, PigHowlUtil.PIG_EXCEPTION_CODE);