private MIndex convertToMIndex(Index index) throws InvalidObjectException,
MetaException {
StorageDescriptor sd = index.getSd();
if (sd == null) {
throw new InvalidObjectException("Storage descriptor is not defined for index.");
}
MStorageDescriptor msd = this.convertToMStorageDescriptor(sd);
MTable origTable = getMTable(index.getDbName(), index.getOrigTableName());
if (origTable == null) {
throw new InvalidObjectException(
"Original table does not exist for the given index.");
}
MTable indexTable = getMTable(index.getDbName(), index.getIndexTableName());
if (indexTable == null) {
throw new InvalidObjectException(
"Underlying index table does not exist for the given index.");
}
return new MIndex(index.getIndexName(), origTable, index.getCreateTime(),
index.getLastAccessTime(), index.getParameters(), indexTable, msd,