if (key.getColumnFamily().equals(Constants.METADATA_DATAFILE_COLUMN_FAMILY)) {
String oldName = new Path(key.getColumnQualifier().toString()).getName();
String newName = fileNameMappings.get(oldName);
if (newName == null) {
throw new ThriftTableOperationException(tableInfo.tableId, tableInfo.tableName, TableOperation.IMPORT, TableOperationExceptionType.OTHER,
"File " + oldName + " does not exist in import dir");
}
cq = new Text("/" + bulkDir + "/" + newName);
} else {
cq = key.getColumnQualifier();
}
if (m == null) {
m = new Mutation(metadataRow);
Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes(Constants.UTF8))));
currentRow = metadataRow;
}
if (!currentRow.equals(metadataRow)) {
mbw.addMutation(m);
m = new Mutation(metadataRow);
Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes(Constants.UTF8))));
}
m.put(key.getColumnFamily(), cq, val);
if (endRow == null && Constants.METADATA_PREV_ROW_COLUMN.hasColumns(key)) {
mbw.addMutation(m);
break; // its the last column in the last row
}
}
break;
}
}
return new MoveExportedFiles(tableInfo);
} catch (IOException ioe) {
log.warn(ioe.getMessage(), ioe);
throw new ThriftTableOperationException(tableInfo.tableId, tableInfo.tableName, TableOperation.IMPORT, TableOperationExceptionType.OTHER,
"Error reading " + path + " " + ioe.getMessage());
} finally {
if (zis != null) {
try {
zis.close();