From c67b155e3fbf76082e2b24fd412efae5838badc6 Mon Sep 17 00:00:00 2001 From: Ken Wenzel Date: Fri, 16 Aug 2024 14:47:47 +0200 Subject: [PATCH] Fix index cache by using file path as key. --- .../linkedfactory/core/kvin/parquet/KvinParquet.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java index 0f6801f1..f548d684 100644 --- a/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java +++ b/bundles/io.github.linkedfactory.core/src/main/java/io/github/linkedfactory/core/kvin/parquet/KvinParquet.java @@ -100,7 +100,7 @@ public class KvinParquet implements Kvin { final Cache itemIdCache = CacheBuilder.newBuilder().maximumSize(10000).build(); final Cache propertyIdCache = CacheBuilder.newBuilder().maximumSize(10000).build(); final Cache contextIdCache = CacheBuilder.newBuilder().maximumSize(10000).build(); - final Cache, ColumnIndexStore> indexCache = CacheBuilder.newBuilder().maximumSize(10000).build(); + final Cache, ColumnIndexStore> indexCache = CacheBuilder.newBuilder().maximumSize(10000).build(); // Lock Map inputFileCache = new HashMap<>(); // hadoop input file cache @@ -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 columnIndexes = new HashMap<>(); Map offsetIndexes = new HashMap<>(); int i = 0; @@ -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;