@@ -89,9 +89,15 @@ impl BasicHashJoin {
8989 }
9090
9191 pub ( crate ) fn final_build ( & mut self ) -> Result < Option < ProgressValues > > {
92- if let Some ( true ) = self . init_memory_hash_table ( ) {
93- return Ok ( Some ( self . build_nested_loop ( ) ) ) ;
94- } ;
92+ match self . state . hash_table . deref ( ) {
93+ HashJoinHashTable :: Null => match self . init_memory_hash_table ( ) {
94+ Some ( true ) => return Ok ( Some ( self . build_nested_loop ( ) ) ) ,
95+ Some ( false ) => return Ok ( None ) ,
96+ None => { }
97+ } ,
98+ HashJoinHashTable :: NestedLoop ( _) => return Ok ( None ) ,
99+ _ => { }
100+ }
95101
96102 let Some ( chunk_index) = self . state . steal_chunk_index ( ) else {
97103 return Ok ( None ) ;
@@ -176,16 +182,15 @@ impl BasicHashJoin {
176182 }
177183
178184 fn init_memory_hash_table ( & mut self ) -> Option < bool > {
179- if !matches ! ( self . state. hash_table. deref( ) , HashJoinHashTable :: Null ) {
180- return None ;
181- }
182185 let skip_duplicates = matches ! ( self . desc. join_type, JoinType :: InnerAny | JoinType :: LeftAny ) ;
183186
184187 let locked = self . state . mutex . lock ( ) ;
185188 let _locked = locked. unwrap_or_else ( PoisonError :: into_inner) ;
186189
187- if !matches ! ( self . state. hash_table. deref( ) , HashJoinHashTable :: Null ) {
188- return None ;
190+ match self . state . hash_table . deref ( ) {
191+ HashJoinHashTable :: Null => { }
192+ HashJoinHashTable :: NestedLoop ( _) => return Some ( false ) ,
193+ _ => return None ,
189194 }
190195
191196 let build_num_rows = * self . state . build_rows . deref ( ) ;
@@ -304,7 +309,7 @@ impl BasicHashJoin {
304309 )
305310 }
306311 } ;
307- Some ( false )
312+ None
308313 }
309314
310315 fn build_hash_table ( & self , keys : DataBlock , chunk_idx : usize ) -> Result < ( ) > {
0 commit comments