Skip to content

[ENH] Prefetch block by prefixes #4623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: sicheng/05-19-_tst_add_unit_test_for_literal_expr
Choose a base branch
from

Conversation

Sicheng-Pan
Copy link
Contributor

@Sicheng-Pan Sicheng-Pan commented May 23, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • N/A
  • New functionality
    • Implements blockfile prefetch by prefix

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor Author

Sicheng-Pan commented May 23, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Sicheng-Pan Sicheng-Pan mentioned this pull request May 23, 2025
1 task
Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

@Sicheng-Pan Sicheng-Pan marked this pull request as ready for review May 23, 2025 19:04
Copy link
Contributor

propel-code-bot bot commented May 23, 2025

Implements Blockfile Prefetch by Prefixes

This PR adds the ability to prefetch multiple blocks in blockfile storage by specifying a set of prefixes, allowing more efficient batched loading of relevant data blocks. The update introduces new methods to ArrowBlockfileReader and related reader interfaces, as well as supporting logic in the sparse index for resolving block IDs from multiple prefixes.

Key Changes:
• Added get_block_ids_for_prefixes method to sparse_index.rs to retrieve block IDs for a set of prefixes.
• Introduced load_blocks_for_prefixes method to ArrowBlockfileReader and BlockfileReader for prefetching by prefixes.
• Updated control flow in the blockfile and reader modules to support asynchronous prefetching logic for prefixes.

Affected Areas:
• rust/blockstore/src/arrow/sparse_index.rs
• rust/blockstore/src/arrow/blockfile.rs
• rust/blockstore/src/types/reader.rs

This summary was automatically generated by @propel-code-bot

@Sicheng-Pan Sicheng-Pan changed the title Prefetch block by prefixes [ENH] Prefetch block by prefixes May 23, 2025
@Sicheng-Pan Sicheng-Pan force-pushed the sicheng/05-21-_enh_prefetch_block_by_prefixes branch from f3cedac to 78dbbb3 Compare May 23, 2025 19:51
@Sicheng-Pan Sicheng-Pan force-pushed the sicheng/05-19-_tst_add_unit_test_for_literal_expr branch from dedfbd1 to 3feb7e0 Compare May 23, 2025 19:51
prefixes: impl IntoIterator<Item = &'prefix str>,
) {
match self {
BlockfileReader::MemoryBlockfileReader(_reader) => unimplemented!(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[BestPractice]

It looks like you've implemented an unimplemented!() case for MemoryBlockfileReader. While this works for now, consider adding a TODO comment explaining when this might be implemented or why it's left unimplemented to help future developers understand the design decision.

@@ -362,7 +362,47 @@ impl SparseIndexReader {
result_uuids
}

pub(super) fn get_block_ids_range<'prefix, 'referred_data, PrefixRange>(
pub(super) fn get_block_ids_for_prefixes(&self, mut prefixes: Vec<&str>) -> Vec<Uuid> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Documentation]

The new get_block_ids_for_prefixes function could benefit from some documentation comments explaining its purpose, behavior, and usage - especially since it's a key component of the newly added functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant