jonathanc-n commented on code in PR #17482: URL: https://github.com/apache/datafusion/pull/17482#discussion_r2331953794
########## datafusion/sqllogictest/test_files/joins.slt: ########## @@ -5161,6 +5178,44 @@ WHERE k1 < 0 ---- +# PiecewiseMergeJoin Test +statement ok +set datafusion.execution.batch_size = 8192; + +# TODO: partitioned PWMJ execution Review Comment: Currently doesn't allow partitioned execution, this would make reviewing the tests a little messy as many of the partitioned single range queries would switch to PWMJ. Another follow up, will be tracked in #17427 ########## datafusion/core/src/physical_planner.rs: ########## @@ -1168,10 +1205,105 @@ impl DefaultPhysicalPlanner { let prefer_hash_join = session_state.config_options().optimizer.prefer_hash_join; + let cfg = session_state.config(); + + let can_run_single = + cfg.target_partitions() == 1 || !cfg.repartition_joins(); + + // TODO: Allow PWMJ to deal with residual equijoin conditions let join: Arc<dyn ExecutionPlan> = if join_on.is_empty() { if join_filter.is_none() && matches!(join_type, JoinType::Inner) { // cross join if there is no join conditions and no join filter set Arc::new(CrossJoinExec::new(physical_left, physical_right)) + } else if num_range_filters == 1 Review Comment: I would like to refactor this in another pull request, just a refactor but it should be quite simple to do. Just wanted to get this version in first. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org