Skip to content

Commit

Permalink
Add entry to parquet metadata cache on file modificationTime
Browse files Browse the repository at this point in the history
  • Loading branch information
agrawalreetika committed May 23, 2024
1 parent cf0ac07 commit faa3a55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,8 @@ public void testCaching()
parquetMetadataSource,
tempFile.getFile(),
tempFileModificationTime);
assertEquals(parquetFileMetadataCache.stats().missCount(), 3);
assertEquals(parquetFileMetadataCache.stats().hitCount(), 4);
assertEquals(parquetFileMetadataCache.stats().missCount(), 2);
assertEquals(parquetFileMetadataCache.stats().hitCount(), 5);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public ParquetFileMetadata getParquetMetadata(
ParquetFileMetadata fileMetadataCache = cache.get(
parquetDataSource.getId(),
() -> delegate.getParquetMetadata(parquetDataSource, fileSize, cacheable, modificationTime, fileDecryptor, readMaskedValue));
if (fileMetadataCache.getModificationTime() == modificationTime) {
return fileMetadataCache;
}
else {
if (fileMetadataCache.getModificationTime() != modificationTime) {
cache.invalidate(parquetDataSource.getId());
fileMetadataCache = delegate.getParquetMetadata(parquetDataSource, fileSize, cacheable, modificationTime, fileDecryptor, readMaskedValue);
cache.put(parquetDataSource.getId(), fileMetadataCache);
}
return fileMetadataCache;
}
return delegate.getParquetMetadata(parquetDataSource, fileSize, cacheable, modificationTime, fileDecryptor, readMaskedValue);
}
Expand Down

0 comments on commit faa3a55

Please sign in to comment.