Skip to content

Commit

Permalink
fix: some cr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
v0y4g3r committed Feb 23, 2024
1 parent 7805891 commit aba5c21
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mito2/src/memtable/merge_tree/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ impl DataParts {
/// Reads data from all parts including active and frozen parts.
/// The returned iterator yields a record batch of one primary key at a time.
/// The order of yielding primary keys is determined by provided weights.
/// todo(hl): read may not take any pk weights if is read by `Shard`.
pub fn read(&mut self, pk_weights: &[u16]) -> Result<DataPartsReader> {
let mut nodes = Vec::with_capacity(self.frozen.len() + 1);
nodes.push(DataNode::new(DataSource::Buffer(
Expand Down
19 changes: 19 additions & 0 deletions src/mito2/src/memtable/merge_tree/merger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,4 +622,23 @@ mod tests {
],
);
}

#[test]
fn test_merger_overlapping_3() {
let metadata = metadata_for_test();
let mut buffer1 = DataBuffer::with_capacity(metadata.clone(), 10);
let weight = &[0, 1, 2];
let mut seq = 0;
write_rows_to_buffer(&mut buffer1, &metadata, 0, vec![0, 1], &mut seq);
let node1 = DataNode::new(DataSource::Buffer(buffer1.read(weight).unwrap()));

let mut buffer2 = DataBuffer::with_capacity(metadata.clone(), 10);
write_rows_to_buffer(&mut buffer2, &metadata, 0, vec![1], &mut seq);
let node2 = DataNode::new(DataSource::Buffer(buffer2.read(weight).unwrap()));

check_merger_read(
vec![node1, node2],
&[(0, vec![(0, 0)]), (0, vec![(1, 2)]), (0, vec![(1, 1)])],
);
}
}

0 comments on commit aba5c21

Please sign in to comment.