* @return the zebra tables's SortInfo; null if the table is unsorted.
*/
public static SortInfo getSortInfo(JobConf conf) throws IOException
{
TableExpr expr = getInputExpr(conf);
SortInfo result = null;
int sortSize = 0;
if (expr instanceof BasicTableExpr)
{
BasicTable.Reader reader = new BasicTable.Reader(((BasicTableExpr) expr).getPath(), conf);
SortInfo sortInfo = reader.getSortInfo();
reader.close();
result = sortInfo;
} else {
List<LeafTableInfo> leaves = expr.getLeafTables(null);
for (Iterator<LeafTableInfo> it = leaves.iterator(); it.hasNext(); )
{
LeafTableInfo leaf = it.next();
BasicTable.Reader reader = new BasicTable.Reader(leaf.getPath(), conf);
SortInfo sortInfo = reader.getSortInfo();
reader.close();
if (sortSize == 0)
{
sortSize = sortInfo.size();
result = sortInfo;
} else if (sortSize != sortInfo.size()) {
throw new IOException("Tables of the table union do not possess the same sort property.");
}
}
}
return result;