metadata.close();
}
private static ParquetMetadata mergeFooters(Path root, List<Footer> footers) {
String rootPath = root.toString();
GlobalMetaData fileMetaData = null;
List<BlockMetaData> blocks = new ArrayList<BlockMetaData>();
for (Footer footer : footers) {
String path = footer.getFile().toString();
if (!path.startsWith(rootPath)) {
throw new ParquetEncodingException(path + " invalid: all the files must be contained in the root " + root);
}
path = path.substring(rootPath.length());
while (path.startsWith("/")) {
path = path.substring(1);
}
fileMetaData = mergeInto(footer.getParquetMetadata().getFileMetaData(), fileMetaData);
for (BlockMetaData block : footer.getParquetMetadata().getBlocks()) {
block.setPath(path);
blocks.add(block);
}
}
return new ParquetMetadata(fileMetaData.merge(), blocks);
}