From 668399bee3dc6c0a41c8ed0924eea2d8db691f25 Mon Sep 17 00:00:00 2001 From: Clark Zinzow Date: Mon, 11 Dec 2023 12:43:18 -0800 Subject: [PATCH] [BUG] [Hotfix] [Join Optimization] Fix pre-partitioned check for larger side of join. (#1718) Hotfix for checking whether the larger side of a join is already-partitioned, when determining whether to use a broadcast join or a hash join. --- src/daft-plan/src/planner.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daft-plan/src/planner.rs b/src/daft-plan/src/planner.rs index b8d1018b9e..c59bcdd944 100644 --- a/src/daft-plan/src/planner.rs +++ b/src/daft-plan/src/planner.rs @@ -525,9 +525,9 @@ pub fn plan(logical_plan: &LogicalPlan, cfg: Arc) -> DaftResult (None, false), }; let is_larger_partitioned = if do_swap { - is_right_partitioned - } else { is_left_partitioned + } else { + is_right_partitioned }; // If larger table is not already partitioned on the join key AND the smaller table is under broadcast size threshold, use broadcast join. if !is_larger_partitioned && let Some(smaller_size_bytes) = smaller_size_bytes && smaller_size_bytes <= cfg.broadcast_join_size_bytes_threshold {