From c2b008278a097e971b016f6f2dafd56fdd2d72be Mon Sep 17 00:00:00 2001 From: evenyag Date: Thu, 26 Oct 2023 21:57:51 +0800 Subject: [PATCH] test: test reheap hot --- src/mito2/src/read/merge.rs | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/mito2/src/read/merge.rs b/src/mito2/src/read/merge.rs index 144874984bc4..4e86534476ee 100644 --- a/src/mito2/src/read/merge.rs +++ b/src/mito2/src/read/merge.rs @@ -611,6 +611,47 @@ mod tests { .await; } + #[tokio::test] + async fn test_merge_reheap_hot() { + let reader1 = VecBatchReader::new(&[ + new_batch( + b"k1", + &[1, 3], + &[10, 10], + &[OpType::Put, OpType::Put], + &[21, 23], + ), + new_batch(b"k2", &[3], &[10], &[OpType::Put], &[23]), + ]); + let reader2 = VecBatchReader::new(&[new_batch( + b"k1", + &[2, 4], + &[11, 11], + &[OpType::Put, OpType::Put], + &[32, 34], + )]); + let mut reader = MergeReaderBuilder::new() + .push_batch_reader(Box::new(reader1)) + .push_batch_iter(Box::new(reader2)) + .build() + .await + .unwrap(); + check_reader_result( + &mut reader, + &[ + new_batch( + b"k1", + &[1, 2, 3, 4], + &[10, 11, 10, 11], + &[OpType::Put, OpType::Put, OpType::Put, OpType::Put], + &[21, 32, 23, 34], + ), + new_batch(b"k2", &[3], &[10], &[OpType::Put], &[23]), + ], + ) + .await; + } + #[tokio::test] async fn test_merge_overlapping() { let reader1 = VecBatchReader::new(&[