datafusion-contrib / datafusion-contrib/liquid-cache

Selective Column Admission for Improved Cache Efficiency Under Constrained Memory Budgets

Open
#500 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
452
Forks
51
Avg merge
3h 10m
Merged PRs (30d)
12

Description

Problem

Under constrained memory budgets (production reality), caching all columns wastes memory on large string projections that get read once and evict high-value numeric predicate columns that have strong temporal reuse.

Proposal

Add a mechanism to let integrators control which columns are admitted into the cache — either via:

  • a callback / trait on CachedColumn
  • or a column-level annotation that signals "skip this column"

This would let downstream systems implement their own admission policies without hardcoding any specific strategy into LiquidCache itself.

Our use case

In our workload, we'd use this to skip string/binary columns and projection-only columns, keeping the cache budget focused on numeric predicate columns where Liquid encoding + encoded-data predicate evaluation provide the strongest returns. We recently integrated liquid-cache in OpenSearch #21766 , we modified CachedColumn to track an is_predicate_column flag (derived from LineageOptimizer annotations) and gated both insert() and get_arrow_array_with_filter():

if !self.is_predicate_column || is_string_type(self.field.data_type()) {
    return None; // skip cache
}

Why

  • Numeric predicates have the best Liquid compression ratio and highest reuse (repeated dashboard queries filter on the same columns)
  • A single string column can consume 100x the memory of a numeric column, blowing the budget
  • Predicate columns benefit most from cache residency since they enable the encoded-data evaluation path — projection-only columns still benefit from avoiding IO but have lower reuse in our workload

Impact

On ClickBench with a 1GB budget: caching everything gives ~30% hit rate (strings evict numerics). With selective admission: ~95% hit rate.

@XiangpengHao Really appreciate your work - Happy to open a PR if you'd prefer a concrete proposal to discuss against. Open to whatever API shape makes sense for the project.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading CachedColumn and its insert() and get_arrow_array_with_filter() paths to understand where admission is currently decided. Compare the proposed callback/trait and column-annotation approaches, then define an API that lets integrators skip selected columns and verify that selective admission preserves the intended cache behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.