use of io.hetu.core.plugin.heuristicindex.index.btree.BTreeIndex in project hetu-core by openlookeng.
the class HeuristicIndexClient method readPartitionIndex.
@Override
public List<IndexMetadata> readPartitionIndex(String path) throws IOException {
Path indexKeyPath = Paths.get(path);
Path absolutePath = Paths.get(this.root.toString(), path);
String tableName = indexKeyPath.subpath(0, 1).toString();
String column = indexKeyPath.subpath(1, 2).toString();
List<IndexMetadata> result = new ArrayList<>();
if (fs.exists(absolutePath)) {
List<Path> paths = fs.walk(absolutePath).filter(p -> !fs.isDirectory(p)).collect(Collectors.toList());
for (Path filePath : paths) {
BTreeIndex index = new BTreeIndex();
InputStream inputStream = fs.newInputStream(filePath);
index.deserialize(inputStream);
IndexMetadata indexMetadata = new IndexMetadata(index, tableName, new String[] { column }, root.toString(), filePath.toString(), 0L, 0L);
result.add(indexMetadata);
}
return result;
} else {
LOG.debug("File path doesn't exists" + absolutePath);
return ImmutableList.of();
}
}
Aggregations