if (!path.getFileSystem(conf).exists(pathSchema)) {
throw new IOException("BT Schema file doesn't exist: " + pathSchema);
}
// read schema file
FSDataInputStream in = path.getFileSystem(conf).open(pathSchema);
version = new Version(in);
// verify compatibility against SCHEMA_VERSION
if (!version.compatibleWith(SCHEMA_VERSION)) {
new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
+ "; found in file: " + version);
}
comparator = WritableUtils.readString(in);
String logicalStr = WritableUtils.readString(in);
try {
logical = new Schema(logicalStr);
}
catch (Exception e) {
;
throw new IOException("Schema build failed :" + e.getMessage());
}
storage = WritableUtils.readString(in);
try {
partition = new Partition(logicalStr, storage, comparator);
}
catch (Exception e) {
throw new IOException("Partition constructor failed :" + e.getMessage());
}
cgschemas = partition.getCGSchemas();
int numCGs = WritableUtils.readVInt(in);
physical = new Schema[numCGs];
cgDeletedFlags = new boolean[physical.length];
TableSchemaParser parser;
String cgschemastr;
try {
for (int nx = 0; nx < numCGs; nx++) {
cgschemastr = WritableUtils.readString(in);
parser = new TableSchemaParser(new StringReader(cgschemastr));
physical[nx] = parser.RecordSchema(null);
}
}
catch (Exception e) {
throw new IOException("parser.RecordSchema failed :" + e.getMessage());
}
sorted = WritableUtils.readVInt(in) == 1 ? true : false;
if (deletedCGs == null)
setCGDeletedFlags(path, conf);
else {
for (String deletedCG : deletedCGs)
{
for (int i = 0; i < cgschemas.length; i++)
{
if (cgschemas[i].getName().equals(deletedCG))
cgDeletedFlags[i] = true;
}
}
}
if (version.compareTo(new Version((short)1, (short)0)) > 0)
{
int numSortColumns = WritableUtils.readVInt(in);
if (numSortColumns > 0)
{
String[] sortColumnStr = new String[numSortColumns];