datafusion-contrib / datafusion-contrib/liquid-cache

[Discussion] LiquidCache support for only InMemory transcoding

Open
#405 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

I was trying to see if there is a way in which we can just create inMemory Liquid format and avoid spilling to disk everytime. Wanted to check if currently what are the ways to achieve it? Didn't find it in my initial analysis. Also I found this:

/// Insert a batch into the cache, it will run cache replacement policy until the batch is inserted.
    pub(crate) fn insert_inner(&self, entry_id: EntryID, mut batch_to_cache: CachedBatch) {
        loop {
            let batch_type = CachedBatchType::from(&batch_to_cache);
            let Err(not_inserted) = self.try_insert(entry_id, batch_to_cache) else {
                self.cache_policy.notify_insert(&entry_id, batch_type);
                return;
            };

            let victims = self.cache_policy.find_victim(8);
            if victims.is_empty() {
                // no advice, because the cache is already empty
                // this can happen if the entry to be inserted is too large, in that case,
                // we write it to disk
                let on_disk_batch = self.write_in_memory_batch_to_disk(entry_id, not_inserted);
                batch_to_cache = on_disk_batch;
                continue;
            }
            self.squeeze_victims(victims);

            batch_to_cache = not_inserted;
            crate::utils::yield_now_if_shuttle();
        }
    }

This kind of write it to disk in case of insufficient memory always. @XiangpengHao let me know if I'm missing any very obvious code path..

Just checking on if there is any plan to introduce just InMemoryLiquid mode?

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 at the mentioned insert_inner entry point and trace the current LiquidCache transcoding path, especially write_in_memory_batch_to_disk. Determine whether an InMemory-only mode is intended, then define its scope and acceptance criteria before identifying the tests needed to verify that batches do not spill to disk.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.