Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketkedia committed Jul 22, 2024
1 parent 2b42032 commit bb57aa3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
6 changes: 2 additions & 4 deletions rust/worker/src/blockstore/arrow/blockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl<'me, K: ArrowReadableKey<'me> + Into<KeyWrapper>, V: ArrowReadableValue<'me
join_all(futures).await;
}

pub(crate) async fn load_blocks_for_keys(&self, prefixes: &Vec<&str>, keys: &Vec<K>) -> () {
pub(crate) async fn load_blocks_for_keys(&self, prefixes: Vec<&str>, keys: Vec<K>) -> () {
let mut composite_keys = Vec::new();
let mut prefix_iter = prefixes.iter();
let mut key_iter = keys.iter();
Expand All @@ -294,9 +294,7 @@ impl<'me, K: ArrowReadableKey<'me> + Into<KeyWrapper>, V: ArrowReadableValue<'me
composite_keys.push(composite_key);
}
}
let target_block_ids = self
.sparse_index
.get_all_target_block_ids(&mut composite_keys);
let target_block_ids = self.sparse_index.get_all_target_block_ids(composite_keys);
self.load_blocks(target_block_ids).await;
}

Expand Down
5 changes: 1 addition & 4 deletions rust/worker/src/blockstore/arrow/sparse_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ impl SparseIndex {
reverse.insert(block_id, SparseIndexDelimiter::Start);
}

pub(super) fn get_all_target_block_ids(
&self,
search_keys: &mut Vec<CompositeKey>,
) -> Vec<Uuid> {
pub(super) fn get_all_target_block_ids(&self, mut search_keys: Vec<CompositeKey>) -> Vec<Uuid> {
// Sort so that we can search in one iteration.
search_keys.sort();
let mut result_uuids = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion rust/worker/src/blockstore/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl<
}
}

pub(crate) async fn load_blocks_for_keys(&self, prefixes: &Vec<&str>, keys: &Vec<K>) -> () {
pub(crate) async fn load_blocks_for_keys(&self, prefixes: Vec<&str>, keys: Vec<K>) -> () {
match self {
BlockfileReader::MemoryBlockfileReader(reader) => unimplemented!(),
BlockfileReader::ArrowBlockfileReader(reader) => {
Expand Down
12 changes: 6 additions & 6 deletions rust/worker/src/segment/record_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,22 +814,22 @@ impl RecordSegmentReader<'_> {
self.id_to_data.count().await
}

pub(crate) async fn prefetch_id_to_data(&self, keys: &Vec<u32>) -> () {
pub(crate) async fn prefetch_id_to_data(&self, keys: Vec<u32>) -> () {
let prefixes = vec![""; keys.len()];
self.id_to_data.load_blocks_for_keys(&prefixes, keys).await
self.id_to_data.load_blocks_for_keys(prefixes, keys).await
}

pub(crate) async fn prefetch_user_id_to_id(&self, keys: &Vec<&str>) -> () {
pub(crate) async fn prefetch_user_id_to_id(&self, keys: Vec<&str>) -> () {
let prefixes = vec![""; keys.len()];
self.user_id_to_id
.load_blocks_for_keys(&prefixes, keys)
.load_blocks_for_keys(prefixes, keys)
.await
}

pub(crate) async fn prefetch_id_to_user_id(&self, keys: &Vec<u32>) -> () {
pub(crate) async fn prefetch_id_to_user_id(&self, keys: Vec<u32>) -> () {
let prefixes = vec![""; keys.len()];
self.id_to_user_id
.load_blocks_for_keys(&prefixes, keys)
.load_blocks_for_keys(prefixes, keys)
.await
}
}

0 comments on commit bb57aa3

Please sign in to comment.