j++;
requiredFieldList.getFields().add(j, requiredField);
}
boolean[] columnRequired = new boolean[load.getSchema().size()];
RequiredFieldResponse response = null;
try {
response = load.pushProjection(requiredFieldList);
} catch (FrontendException e) {
log.warn("fieldsToRead on "+load+" throw an exception, skip it");
}
// If the request is not granted, probably the loader support position prune only,
// and do not prune map key pruning (such as PigStorage). Drop all map keys (means
// we do not prune map keys) and try again
if (response==null || !response.getRequiredFieldResponse())
{
for (RequiredField rf : requiredFieldList.getFields())
{
if (rf.getType() == DataType.MAP)
rf.setSubFields(null);
}
try {
response = load.pushProjection(requiredFieldList);
} catch (FrontendException e) {
log.warn("fieldsToRead on "+load+" throw an exception, skip it");
}
}
// Loader does not support column pruning, insert foreach
LogicalOperator forEach = null;
if (response==null || !response.getRequiredFieldResponse())
{
List<Integer> columnsToProject = new ArrayList<Integer>();
for (RequiredField rf : requiredFieldList.getFields())
columnsToProject.add(rf.getIndex());