Skip to content

Commit 1b8895a

Browse files
committed
x
1 parent d254330 commit 1b8895a

File tree

10 files changed

+315
-165
lines changed

10 files changed

+315
-165
lines changed

src/query/service/src/pipelines/processors/transforms/hash_join/hash_join_build_state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ impl HashJoinBuildState {
744744
"Aborted query, because the hash table is uninitialized.",
745745
));
746746
}
747+
HashJoinHashTable::NestedLoop(_) => unreachable!(),
747748
HashJoinHashTable::SkipDuplicatesSerializer(table) => insert_binary_key! {
748749
&mut table.hash_table, &table.hash_method, chunk, build_keys, valids, chunk_index as u32, entry_size, &mut local_raw_entry_spaces,
749750
},

src/query/service/src/pipelines/processors/transforms/hash_join/hash_join_probe_state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ impl HashJoinProbeState {
165165
// Continue to probe hash table and process data blocks.
166166
self.result_blocks(probe_state, keys, &table.hash_table)
167167
}
168+
HashJoinHashTable::NestedLoop(_) => unreachable!(),
168169
HashJoinHashTable::Null => Err(ErrorCode::AbortedQuery(
169170
"Aborted query, because the hash table is uninitialized.",
170171
)),
@@ -376,6 +377,7 @@ impl HashJoinProbeState {
376377
// Continue to probe hash table and process data blocks.
377378
self.result_blocks(probe_state, keys, &table.hash_table)
378379
}
380+
HashJoinHashTable::NestedLoop(_) => unreachable!(),
379381
HashJoinHashTable::Null => Err(ErrorCode::AbortedQuery(
380382
"Aborted query, because the hash table is uninitialized.",
381383
)),

src/query/service/src/pipelines/processors/transforms/hash_join/hash_join_state.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pub struct FixedKeyHashJoinHashTable<
7878

7979
pub enum HashJoinHashTable {
8080
Null,
81+
NestedLoop(Vec<DataBlock>),
8182
Serializer(SerializerHashJoinHashTable),
8283
SkipDuplicatesSerializer(SkipDuplicatesSerializerHashJoinHashTable),
8384
SingleBinary(SingleBinaryHashJoinHashTable),
@@ -348,9 +349,9 @@ impl HashJoinState {
348349
}
349350

350351
impl HashJoinHashTable {
351-
pub fn len(&self) -> usize {
352-
match self {
353-
HashJoinHashTable::Null => 0,
352+
pub fn size(&self) -> Option<usize> {
353+
let n = match self {
354+
HashJoinHashTable::Null | HashJoinHashTable::NestedLoop(_) => return None,
354355
HashJoinHashTable::Serializer(table) => table.hash_table.len(),
355356
HashJoinHashTable::SingleBinary(table) => table.hash_table.len(),
356357
HashJoinHashTable::KeysU8(table) => table.hash_table.len(),
@@ -367,11 +368,7 @@ impl HashJoinHashTable {
367368
HashJoinHashTable::SkipDuplicatesKeysU64(table) => table.hash_table.len(),
368369
HashJoinHashTable::SkipDuplicatesKeysU128(table) => table.hash_table.len(),
369370
HashJoinHashTable::SkipDuplicatesKeysU256(table) => table.hash_table.len(),
370-
}
371-
}
372-
373-
#[allow(dead_code)]
374-
pub fn is_empty(&self) -> bool {
375-
self.len() == 0
371+
};
372+
Some(n)
376373
}
377374
}

src/query/service/src/pipelines/processors/transforms/hash_join/result_blocks.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ impl HashJoinProbeState {
5454
JoinType::InnerAny | JoinType::RightAny
5555
) {
5656
let hash_table = unsafe { &*self.hash_join_state.hash_table.get() };
57-
probe_state.used_once = Some(MutableBitmap::from_len_zeroed(hash_table.len()))
57+
probe_state.used_once = Some(MutableBitmap::from_len_zeroed(
58+
hash_table.size().unwrap_or_default(),
59+
))
5860
}
5961
let no_other_predicate = self
6062
.hash_join_state

0 commit comments

Comments
 (0)