-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parquet: Lazy dictionary loading, shared page caches, and better file…
… channel cache behavior (#1130) * Lazy-loading and soft-reference caching at every level for Parquet dictionaries. * Extract PageCache from ColumnChunkPageStore and create them at the ParquetColumnLocation level. * Do a better job of exploiting our channel cache.
- Loading branch information
Showing
21 changed files
with
802 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
DB/src/main/java/io/deephaven/db/v2/locations/parquet/PageCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.deephaven.db.v2.locations.parquet; | ||
|
||
import io.deephaven.db.v2.sources.chunk.Attributes.Any; | ||
import io.deephaven.db.v2.sources.chunk.page.ChunkPage; | ||
import io.deephaven.util.datastructures.intrusive.IntrusiveSoftLRU; | ||
|
||
import java.lang.ref.WeakReference; | ||
|
||
/** | ||
* Page cache data structure. | ||
*/ | ||
public class PageCache<ATTR extends Any> extends IntrusiveSoftLRU<PageCache.IntrusivePage<ATTR>> { | ||
|
||
/** | ||
* Sentinel reference for a null page | ||
*/ | ||
private static final WeakReference<?> NULL_PAGE = new WeakReference<>(null); | ||
|
||
/** | ||
* @return The null page sentinel | ||
*/ | ||
public static <ATTR extends Any> WeakReference<IntrusivePage<ATTR>> getNullPage() { | ||
// noinspection unchecked | ||
return (WeakReference<IntrusivePage<ATTR>>) NULL_PAGE; | ||
} | ||
|
||
/** | ||
* Intrusive data structure for page caching. | ||
*/ | ||
public static class IntrusivePage<ATTR extends Any> extends IntrusiveSoftLRU.Node.Impl<IntrusivePage<ATTR>> { | ||
|
||
private final ChunkPage<ATTR> page; | ||
|
||
public IntrusivePage(ChunkPage<ATTR> page) { | ||
this.page = page; | ||
} | ||
|
||
public ChunkPage<ATTR> getPage() { | ||
return page; | ||
} | ||
} | ||
|
||
public <ATTR2 extends Any> PageCache<ATTR2> castAttr() { | ||
// noinspection unchecked | ||
return (PageCache<ATTR2>) this; | ||
} | ||
|
||
public PageCache(final int maxSize) { | ||
super(IntrusiveSoftLRU.Node.Adapter.getInstance(), maxSize); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.