Skip to content

Conversation

jonathanc-n
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

We need to support Sort Merge Join, Symmetric Hash Join and swapping join sides for Mark Joins.

What changes are included in this PR?

Support SMJ + SHJ

  • Added tests + join support for SortMergeJoin and SymmetricHashJoin

Added Support for Swap

  • Added mark joins for being supported by swap.
  • Projection swapping as well.

Are these changes tested?

Yes added unit tests, and sqllogictests shows that swapping support works

@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) common Related to common crate physical-plan Changes to the physical-plan crate labels Jun 20, 2025
@jonathanc-n jonathanc-n changed the title feat: Finalize support for RightMark join feat: Finalize support for RightMark join + Mark join swap Jun 20, 2025
@jonathanc-n
Copy link
Contributor Author

If you have the time, are you able to take a look? Should be a straightforward review, thanks! @comphead @Dandandan

@comphead
Copy link
Contributor

If you have the time, are you able to take a look? Should be a straightforward review, thanks! @comphead @Dandandan

Thanks @jonathanc-n its on my list!

02)--FilterExec: t1_id@0 > 40 OR NOT mark@3, projection=[t1_id@0, t1_name@1, t1_int@2]
03)----CoalesceBatchesExec: target_batch_size=2
04)------HashJoinExec: mode=CollectLeft, join_type=LeftMark, on=[(t1_id@0, t2_id@0)]
04)------HashJoinExec: mode=CollectLeft, join_type=RightMark, on=[(t2_id@0, t1_id@0)]
Copy link
Contributor

Choose a reason for hiding this comment

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

why this suddenly changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Swapping is now supported, so it was optimized to swap in the physical plan based on the table sizes

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @jonathanc-n this makes to me

@comphead comphead merged commit d73f0e8 into apache:main Jun 27, 2025
27 checks passed
@alamb
Copy link
Contributor

alamb commented Jun 27, 2025

The extended tests started failing after this PR was merged:

comphead added a commit to comphead/arrow-datafusion that referenced this pull request Jun 27, 2025
comphead added a commit that referenced this pull request Jun 27, 2025
@jonathanc-n jonathanc-n deleted the right-mark-smj branch October 10, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules physical-plan Changes to the physical-plan crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement RightMark join

3 participants