From 497be9653bfb381891ef0c338dc830bc9ee8e528 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Berkay=20=C5=9Eahin?=
<124376117+berkaysynnada@users.noreply.github.com>
Date: Wed, 4 Oct 2023 11:22:17 +0300
Subject: [PATCH] Rewrite Filter Predicate (#192)
---
SYNNADA-CONTRIBUTIONS.txt | 2 +-
.../join_pipeline_selection.rs | 24 +-
.../src/physical_optimizer/join_selection.rs | 5 +-
.../physical_optimizer/pipeline_checker.rs | 2 +-
datafusion/physical-plan/src/joins/mod.rs | 5 +-
.../physical-plan/src/joins/prunability.rs | 3461 +++++++++++++++++
datafusion/physical-plan/src/joins/utils.rs | 2323 +----------
.../join_disable_repartition_joins.slt | 37 +
dev/release/rat_exclude_files.txt | 1 +
9 files changed, 3573 insertions(+), 2287 deletions(-)
create mode 100644 datafusion/physical-plan/src/joins/prunability.rs
diff --git a/SYNNADA-CONTRIBUTIONS.txt b/SYNNADA-CONTRIBUTIONS.txt
index 68f27cd9db5e..a685527a943d 100644
--- a/SYNNADA-CONTRIBUTIONS.txt
+++ b/SYNNADA-CONTRIBUTIONS.txt
@@ -15,4 +15,4 @@ c250200fdd8f10e65b52ca1ab7f41bb04992d10b
13c5774511ad2259907d3eebcd8897e1ec5aeed5
768927edfd06936416952031c776de97704b4986
89834f047a92ddbf892633046663bcba88da05d5
-998140f5b53283adfa89da532a2c97cbfcccd88b
\ No newline at end of file
+998140f5b53283adfa89da532a2c97cbfcccd88b
diff --git a/datafusion/core/src/physical_optimizer/join_pipeline_selection.rs b/datafusion/core/src/physical_optimizer/join_pipeline_selection.rs
index eafcd0a65e29..08e7d9001e80 100644
--- a/datafusion/core/src/physical_optimizer/join_pipeline_selection.rs
+++ b/datafusion/core/src/physical_optimizer/join_pipeline_selection.rs
@@ -4,14 +4,12 @@
use std::sync::Arc;
use crate::physical_optimizer::utils::{is_hash_join, is_nested_loop_join, is_sort};
-use crate::physical_plan::joins::utils::is_filter_expr_prunable;
use crate::physical_plan::joins::{
HashJoinExec, NestedLoopJoinExec, SlidingHashJoinExec, SlidingNestedLoopJoinExec,
SortMergeJoinExec, StreamJoinPartitionMode,
};
use crate::physical_plan::sorts::sort::SortExec;
use crate::physical_plan::{with_new_children_if_necessary, ExecutionPlan};
-use datafusion_physical_plan::joins::utils::swap_join_type;
use datafusion_common::config::ConfigOptions;
use datafusion_common::tree_node::{Transformed, TreeNode, VisitRecursion};
@@ -21,10 +19,14 @@ use datafusion_physical_expr::utils::{
ordering_satisfy_requirement_concrete,
};
use datafusion_physical_expr::PhysicalSortRequirement;
-
+use datafusion_physical_plan::joins::prunability::{
+ is_filter_expr_prunable, separate_columns_of_filter_expression,
+};
+use datafusion_physical_plan::joins::utils::swap_join_type;
use datafusion_physical_plan::joins::{
swap_sliding_hash_join, swap_sliding_nested_loop_join, swap_sort_merge_join,
};
+
use itertools::{iproduct, izip, Itertools};
/// This object is used within the JoinSelection rule to track the closest
@@ -328,7 +330,11 @@ fn check_hash_join_convertable(
hash_join: &HashJoinExec,
config_options: &ConfigOptions,
) -> Result