@Override
public Schema determineSchema(String fileName, ExecType execType,
DataStorage storage) throws IOException {
checkConf(storage, fileName);
Projection projection;
org.apache.hadoop.zebra.types.Schema projectionSchema;
if (!fileName.contains(",")) { // one table;
org.apache.hadoop.zebra.types.Schema tschema = BasicTable.Reader.getSchema(new Path(fileName), jobConf);
try {
projection = new org.apache.hadoop.zebra.types.Projection(tschema, TableInputFormat.getProjection(jobConf));
projectionSchema = projection.getProjectionSchema();
} catch (ParseException e) {
throw new IOException("Schema parsing failed : "+e.getMessage());
}
} else { // table union;
org.apache.hadoop.zebra.types.Schema unionSchema = new org.apache.hadoop.zebra.types.Schema();
for (Path p : paths) {
org.apache.hadoop.zebra.types.Schema schema = BasicTable.Reader.getSchema(p, jobConf);
try {
unionSchema.unionSchema(schema);
} catch (ParseException e) {
throw new IOException(e.getMessage());
}
}
try {
projection = new org.apache.hadoop.zebra.types.Projection(unionSchema, TableInputFormat.getProjection(jobConf));
projectionSchema = projection.getProjectionSchema();
} catch (ParseException e) {
throw new IOException("Schema parsing failed : "+e.getMessage());
}
}