You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think a SortMergeJoin derivative that handles inequality could be helpful here but there are comments that SortMergeJoin is not used in plans yet.
Is there a reason for this?
The optimization to execute join conditions like t1.id <= t2.id efficiently with SMJ is not implemented yet, now SMJ can only handle an equal join condition (plus additional join conditions to be processed after the equal condition is evaluated)
TLDR while this is straight forward bug report, I think fixing it is not not something we are going to make a patch for -- it will require a more serious implementation effort for joins in DataFusion
Joins implementations in general are a complex topic. Maybe it is time to mount and organize a project to improve the situation in DataFusion
As @Dandandan alluded to, I don't think we need to reinvent this feature -- there is lots of prior academic work on this topic.
What I suggest is that someone updates our documentation with the current state of joins in DataFusion (namely what operators are implemented and what types of joins they are used for any limitations
Then we can figure out which of the many many exotic join algorithms / implementations exist would be good to move on.
What I suggest is that someone updates our documentation with the current state of joins in DataFusion (namely what operators are implemented and what types of joins they are used for any limitations
Then we can figure out which of the many many exotic join algorithms / implementations exist would be good to move on.
Makes a lot of sense. For new contributors/users who are interested in the Join topic, this proposal would definitely be helpful and clear
I can try and help this effort in a few weeks, but I need to finish up the filter pushdown work in parquet and topk work first (I have too many things outstanding at the moment and am spread too thin)
Activity
kosiew commentedon Apr 14, 2025
take
kosiew commentedon Apr 17, 2025
@alamb
I think a SortMergeJoin derivative that handles inequality could be helpful here but there are comments that
SortMergeJoin is not used in plans yet.
Is there a reason for this?
2010YOUY01 commentedon Apr 18, 2025
The optimization to execute join conditions like
t1.id <= t2.idefficiently with SMJ is not implemented yet, now SMJ can only handle an equal join condition (plus additional join conditions to be processed after the equal condition is evaluated)2010YOUY01 commentedon Apr 18, 2025
I think #15760 is needed to fix the issue.
kosiew commentedon Apr 19, 2025
@2010YOUY01
What do you think of using sorted inputs, just like SortMergeJoinExec
Instead of ==, allow conditions like:
t1.id < t2.id
t1.timestamp <= t2.event_time
For each row in left, scan right from current pointer and stop afer emitting LIMIT rows
Dandandan commentedon Apr 19, 2025
There is also a now closed PR for IEJoin
#12754 (review)
That allows joining on some other conditions.
alamb commentedon Apr 19, 2025
TLDR while this is straight forward bug report, I think fixing it is not not something we are going to make a patch for -- it will require a more serious implementation effort for joins in DataFusion
Joins implementations in general are a complex topic. Maybe it is time to mount and organize a project to improve the situation in DataFusion
As @Dandandan alluded to, I don't think we need to reinvent this feature -- there is lots of prior academic work on this topic.
What I suggest is that someone updates our documentation with the current state of joins in DataFusion (namely what operators are implemented and what types of joins they are used for any limitations
Then we can figure out which of the many many exotic join algorithms / implementations exist would be good to move on.
xudong963 commentedon Apr 19, 2025
Makes a lot of sense. For new contributors/users who are interested in the Join topic, this proposal would definitely be helpful and clear
alamb commentedon Apr 19, 2025
I can try and help this effort in a few weeks, but I need to finish up the filter pushdown work in parquet and topk work first (I have too many things outstanding at the moment and am spread too thin)
mmooyyii commentedon Oct 24, 2025
It fixed after datafusion-cli 50.2.0, @kosiew
2010YOUY01 commentedon Oct 27, 2025
We haven't implement this idea yet, the reproducer query is working I think is due to NLJ is rewritten to limit intermediate data size in #16996
I think pushing limit to joins is a good idea and it can speed up certain workloads, filed #18295 to track it.