From 879cd416d95197553fc860d4448101907e69c74a Mon Sep 17 00:00:00 2001 From: Eduard Karacharov Date: Sun, 14 Jan 2024 18:33:55 +0200 Subject: [PATCH] comments & formatting --- datafusion/physical-plan/src/joins/hash_join.rs | 6 +++--- datafusion/physical-plan/src/joins/symmetric_hash_join.rs | 1 + datafusion/physical-plan/src/joins/utils.rs | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rs index adcac4bca064..8886a3ac5588 100644 --- a/datafusion/physical-plan/src/joins/hash_join.rs +++ b/datafusion/physical-plan/src/joins/hash_join.rs @@ -987,7 +987,8 @@ impl RecordBatchStream for HashJoinStream { } } -/// Lookups by hash agaist JoinHashMap and resolves potential hash collisions. +/// Executes lookups by hash against JoinHashMap and resolves potential +/// hash collisions. /// Returns build/probe indices satisfying the equality condition, along with /// starting point for next iteration. /// @@ -1266,9 +1267,8 @@ impl HashJoinStream { state.offset, )?; - // apply join filters if exists + // apply join filter if exists let (left_indices, right_indices) = if let Some(filter) = &self.filter { - // Filter the indices which satisfy the non-equal join condition, like `left.b1 = 10` apply_join_filter_to_indices( build_side.left_data.batch(), &state.batch, diff --git a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs index e974ffa81ccd..e6478b759335 100644 --- a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs +++ b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs @@ -891,6 +891,7 @@ fn lookup_join_hashmap( .iter() .map(|c| c.evaluate(build_batch)?.into_array(build_batch.num_rows())) .collect::>>()?; + hashes_buffer.clear(); hashes_buffer.resize(probe_batch.num_rows(), 0); let hash_values = create_hashes(&keys_values, random_state, hashes_buffer)?; diff --git a/datafusion/physical-plan/src/joins/utils.rs b/datafusion/physical-plan/src/joins/utils.rs index a6d784502cdc..a4ffde87645b 100644 --- a/datafusion/physical-plan/src/joins/utils.rs +++ b/datafusion/physical-plan/src/joins/utils.rs @@ -138,6 +138,7 @@ impl JoinHashMap { } } +// Type of offsets for obtaining indices from JoinHashMap. pub(crate) type JoinHashMapOffset = (usize, Option); // Trait defining methods that must be implemented by a hash map type to be used for joins.