if (familyDirStatuses == null) {
throw new FileNotFoundException("No families found in " + hfofDir);
}
HTableDescriptor htd = new HTableDescriptor(tableName);
HColumnDescriptor hcd = null;
// Add column families
// Build a set of keys
byte[][] keys = null;
TreeMap<byte[], Integer> map = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
for (FileStatus stat : familyDirStatuses) {
if (!stat.isDir()) {
LOG.warn("Skipping non-directory " + stat.getPath());
continue;
}
Path familyDir = stat.getPath();
// Skip _logs, etc
if (familyDir.getName().startsWith("_")) continue;
byte[] family = familyDir.getName().getBytes();
hcd = new HColumnDescriptor(family);
htd.addFamily(hcd);
Path[] hfiles = FileUtil.stat2Paths(fs.listStatus(familyDir));
for (Path hfile : hfiles) {
if (hfile.getName().startsWith("_")) continue;
HFile.Reader reader = HFile.createReader(fs, hfile,
new CacheConfig(getConf()));
final byte[] first, last;
try {
if (hcd.getCompressionType() != reader.getCompressionAlgorithm()) {
hcd.setCompressionType(reader.getCompressionAlgorithm());
LOG.info("Setting compression " + hcd.getCompressionType().name() +
" for family " + hcd.toString());
}
reader.loadFileInfo();
first = reader.getFirstRowKey();
last = reader.getLastRowKey();