From 2312cbdc506f2ecb213cd1df8d6d9d946fe7ac21 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 13 Feb 2026 12:51:57 -0500 Subject: [PATCH 1/2] Avoid HashJoinExecBuilder when computing properties --- .../physical-plan/src/joins/hash_join/exec.rs | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/datafusion/physical-plan/src/joins/hash_join/exec.rs b/datafusion/physical-plan/src/joins/hash_join/exec.rs index eb2e841791cd..2549c1ccf318 100644 --- a/datafusion/physical-plan/src/joins/hash_join/exec.rs +++ b/datafusion/physical-plan/src/joins/hash_join/exec.rs @@ -839,9 +839,35 @@ impl HashJoinExec { can_project(&self.schema(), projection.as_deref())?; let projection = combine_projections(projection.as_ref(), self.projection.as_ref())?; - HashJoinExecBuilder::from(self) - .with_projection_ref(projection) - .build() + + let cache = HashJoinExec::compute_properties( + &self.left, + &self.right, + &self.join_schema, + self.join_type, + &self.on, + self.mode, + projection.as_deref(), + )?; + + Ok(HashJoinExec { + left: Arc::clone(&self.left), + right: Arc::clone(&self.right), + on: self.on.clone(), + filter: self.filter.clone(), + join_type: self.join_type, + join_schema: Arc::clone(&self.join_schema), + left_fut: Arc::clone(&self.left_fut), + random_state: self.random_state.clone(), + mode: self.mode, + metrics: self.metrics.clone(), + projection, + column_indices: self.column_indices.clone(), + null_equality: self.null_equality, + null_aware: self.null_aware, + cache, + dynamic_filter: self.dynamic_filter.clone(), + }) } /// This function creates the cache object that stores the plan properties such as schema, equivalence properties, ordering, partitioning, etc. From 2a94742ec2368f1e27bd2fd31e2d8206ce2f9848 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 13 Feb 2026 12:57:06 -0500 Subject: [PATCH 2/2] fmt --- datafusion/physical-plan/src/joins/hash_join/exec.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/datafusion/physical-plan/src/joins/hash_join/exec.rs b/datafusion/physical-plan/src/joins/hash_join/exec.rs index 2549c1ccf318..2f99d9c6c48d 100644 --- a/datafusion/physical-plan/src/joins/hash_join/exec.rs +++ b/datafusion/physical-plan/src/joins/hash_join/exec.rs @@ -867,6 +867,7 @@ impl HashJoinExec { null_aware: self.null_aware, cache, dynamic_filter: self.dynamic_filter.clone(), + fetch: self.fetch, }) }