Skip to content

Conversation

@jonathanc-n
Copy link
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

Allow users to understand some decisions for when to change certain joins configurations.

What changes are included in this PR?

Add readme to joins physical plan

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the physical-plan Changes to the physical-plan crate label Oct 21, 2025
@jonathanc-n
Copy link
Contributor Author

jonathanc-n commented Oct 21, 2025

@comphead This is for the documentation that was mentioned in the PiecewiseMergeJoin pull request

Copy link
Contributor

@2010YOUY01 2010YOUY01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice doc, thank you.

I think it's better to move to https://datafusion.apache.org/user-guide/configs.html#tuning-guide, this should be a user guide instead of an internal doc.

- When enabled, the physical planner may select PiecewiseMergeJoin if there is exactly one range
filter in the join condition.
- Piecewise Merge Join is faster than Nested Loop Join performance wise for single range filter
except for cases where it is joining two large tables (num_rows > 100,000) that are approximately
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in theory PWMJ should still be faster, perhaps we have missed some detail in the implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A later todo may profile some classic cases for PWMJ to see the specific cost

@xudong963
Copy link
Member

I think it's better to move to https://datafusion.apache.org/user-guide/configs.html#tuning-guide, this should be a user guide instead of an internal doc.

I agree

Copy link
Member

@xudong963 xudong963 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I leave a ✅ here, and after moving the doc, it's good to go

@github-actions github-actions bot added documentation Improvements or additions to documentation and removed physical-plan Changes to the physical-plan crate labels Oct 22, 2025
@jonathanc-n
Copy link
Contributor Author

I leave a ✅ here, and after moving the doc, it's good to go

Done!

Use the following command to update a configuration:

```
set datafusion.optimizer.<configuration_name>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to get a real example of setting the param?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see confs are below, I think we can improve this nit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I provided an example right under

- true: favors HashJoin for faster execution when sufficient memory is available.
- false: allows SortMergeJoin to be chosen when more memory-efficient execution is needed.

### enable_piecewise_merge_join (bool, default = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw you may also want include it in tpch cli utility, so people can test TPC queries with this kind of join

@github-actions github-actions bot added the development-process Related to development process of DataFusion label Oct 23, 2025
@alamb alamb changed the title doc: Add Join Physical Plan configuration information doc: Add Join Physical Plan configuration flag to benchmarks Oct 26, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @NGA-TRAN

@alamb alamb changed the title doc: Add Join Physical Plan configuration flag to benchmarks doc: Add Join Physical Plan documentation, and configuration flag to benchmarks Oct 26, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alamb alamb added this pull request to the merge queue Oct 26, 2025
Merged via the queue into apache:main with commit 2bb7bf6 Oct 26, 2025
31 checks passed
Copy link
Contributor

@NGA-TRAN NGA-TRAN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the document, @jonathanc-n—great to know that Symmetric Hash Join and Piecewise Merge Join are available

tobixdev pushed a commit to tobixdev/datafusion that referenced this pull request Nov 2, 2025
…benchmarks (apache#18209)

## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #.

## Rationale for this change
Allow users to understand some decisions for when to change certain
joins configurations.
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

## What changes are included in this PR?
Add readme to joins physical plan
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

## Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

## Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Related to development process of DataFusion documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants