Skip to content

Commit

Permalink
Fix index cache by using file path as key.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenwenzel committed Aug 16, 2024
1 parent 27e7918 commit c67b155
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class KvinParquet implements Kvin {
final Cache<URI, Long> itemIdCache = CacheBuilder.newBuilder().maximumSize(10000).build();
final Cache<URI, Long> propertyIdCache = CacheBuilder.newBuilder().maximumSize(10000).build();
final Cache<URI, Long> contextIdCache = CacheBuilder.newBuilder().maximumSize(10000).build();
final Cache<Pair<String, Integer>, ColumnIndexStore> indexCache = CacheBuilder.newBuilder().maximumSize(10000).build();
final Cache<Pair<Path, Integer>, ColumnIndexStore> indexCache = CacheBuilder.newBuilder().maximumSize(10000).build();

// Lock
Map<Path, InputFileInfo> inputFileCache = new HashMap<>(); // hadoop input file cache
Expand Down Expand Up @@ -891,7 +891,7 @@ public ColumnIndexStore getColumnIndexStore(int blockIndex) {
if (blocksField != null) {
try {
BlockMetaData block = (BlockMetaData) ((List<?>) blocksField.get(this)).get(blockIndex);
return indexCache.get(new Pair<>(block.getPath(), block.getOrdinal()), () -> {
return indexCache.get(new Pair<>(fileInfo.path, block.getOrdinal()), () -> {
Map<ColumnPath, ColumnIndex> columnIndexes = new HashMap<>();
Map<ColumnPath, OffsetIndex> offsetIndexes = new HashMap<>();
int i = 0;
Expand Down Expand Up @@ -959,6 +959,10 @@ public boolean hasNext() {
}
} catch (IOException e) {
throw new UncheckedIOException(e);
} catch (Exception e) {
log.error("Error while reading next element", e);
close();
return false;
}
}
return next != null;
Expand Down

0 comments on commit c67b155

Please sign in to comment.