Schema ret = new Schema();
for (String col : tschema.getColumns()) {
org.apache.hadoop.zebra.schema.Schema.ColumnSchema columnSchema =
tschema.getColumn(col);
if (columnSchema != null) {
ColumnType ct = columnSchema.getType();
if (ct == org.apache.hadoop.zebra.schema.ColumnType.RECORD ||
ct == org.apache.hadoop.zebra.schema.ColumnType.COLLECTION)
ret.add(new FieldSchema(col, toPigSchema(columnSchema.getSchema()), ct.pigDataType()));
else
ret.add(new FieldSchema(col, ct.pigDataType()));
} else {
ret.add(new FieldSchema(null, null));
}
}
return ret;