From ffe73fe03ae3e710c42cc9287092021d632eaf45 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Wed, 9 Oct 2024 22:58:09 +0200 Subject: [PATCH] Make HashJoinExec::join_schema public (#12807) * Make HashJoinExec::join_schema public It is needed by physical optimizers that want to replace the HashJoin with a different type of join, as they need to replace it with an equivalent projection, but HashJoinExec::projection could not be used to build it because it refers to indices in HashJoinExec::join_schema. * Replace it with an accessor --- datafusion/physical-plan/src/joins/hash_join.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rs index 48d648c89a35..74a45a7e4761 100644 --- a/datafusion/physical-plan/src/joins/hash_join.rs +++ b/datafusion/physical-plan/src/joins/hash_join.rs @@ -415,6 +415,12 @@ impl HashJoinExec { &self.join_type } + /// The schema after join. Please be careful when using this schema, + /// if there is a projection, the schema isn't the same as the output schema. + pub fn join_schema(&self) -> &SchemaRef { + &self.join_schema + } + /// The partitioning mode of this hash join pub fn partition_mode(&self) -> &PartitionMode { &self.mode