conf_ = conf;
store_ = new FileStore(conf); // only choice for now
// check and load the schema
if(store_.tableExists(parent_.getName(), tableName) == false) {
throw new UnknownTableException("metadata does not exist");
}
schema_ = store_.load(parent, tableName);
// check the table location is on the default dfs server for safety
whPath_ = new Path(schema_.getProperty(Constants.META_TABLE_LOCATION));
if(whPath_.toUri().relativize(parent.whRoot_.toUri()) == null) {
// something potentially wrong as the stored warehouse not the same as our default
// in general we want this, but in the short term, it can't happen
LOG.warn(whPath_ + " is not the current default fs");
}
// check the data directory is there
try {
if(whPath_.getFileSystem(conf).exists(whPath_) == false) {
throw new UnknownTableException("data does not exist:" + whPath_);
}
} catch(IOException e) {
// ignore
}
}