Skip to content

[DISCUSSION] JOIN "task force" / project team #15885

Open

Description

@alamb

What I see (what problem we are trying to solve)

DataFusion's current join implementations are fairly basic. They are functional enough to run TPCH and TPC-DS, but lack other features such as larger-than-memory processing, ASOF joins, complete subquery support and more.

There seems to be a non trivial desire in the community to improve this.

Some examples of issues / tickets related to enhanced join support / features:

Subqueries (which are implemented as joins)

Join Features

Specialized Joins

Performance

What is blocking significant forward progress

In my mind, the major challenge is that "improving" JOINs can get arbitrarily complicated. There are dozens of academic paper each year on various aspects of join implemnetations, and designing / implementing join capabilities is a substantial engineering effort.

I spent 6 years of my life doing joins at Vertica where they accounted for around 50% of the optimizer's complexity, to give some sense

I don't think the issue is that any particular feature is super complicated to understand, but defining the overall goal, the framework that will accomodate the goal, and then breaking it down into implementable pieces itself I think will require both specialized knowledge and substantial time.

What I suggest

I suggest that people with the relevant skills and time to invest gather together to drive this process worward

  1. plan out a "join roadmap" (aka prioritize what join features they will push forward)
  2. Figure out what, if any, new structures are in place
  3. Start breaking it down into smaller tickets
    I can't personally lead such an effort, but I am filing this ticket to try and help connect the relevant people in the community that can.

Some potential people that could help (sorry if I didn't list you)

Related content:

Related blogs (join ordering section in part 2): https://www.influxdata.com/blog/optimizing-sql-dataframes-part-two/

Activity

  1. milenkovicm commented on Apr 29, 2025

    @milenkovicm
    Contributor

    not sure if it will help direction, cost nothing to share :) Debunking the Myth of Join Ordering: Toward Robust SQL Analytics

  2. alamb commented on Apr 29, 2025

    @alamb
    ContributorAuthor

    not sure if it will help direction, cost nothing to share :) Debunking the Myth of Join Ordering: Toward Robust SQL Analytics

    I have that paper on my reading list. Does anyone know of a production system that has implemented the RPT framework?

  3. 2010YOUY01 commented on May 2, 2025

    @2010YOUY01
    Contributor

    not sure if it will help direction, cost nothing to share :) Debunking the Myth of Join Ordering: Toward Robust SQL Analytics

    I have that paper on my reading list. Does anyone know of a production system that has implemented the RPT framework?

    DuckDB is integrating it duckdb/duckdb#17326

  4. xudong963 commented on May 4, 2025

    @xudong963
    Member

    not sure if it will help direction, cost nothing to share :) Debunking the Myth of Join Ordering: Toward Robust SQL Analytics

    I have that paper on my reading list. Does anyone know of a production system that has implemented the RPT framework?

    DuckDB is integrating it duckdb/duckdb#17326

    Cool, looking forward to seeing the final result

  5. alamb commented on May 15, 2025

    @alamb
    ContributorAuthor

    In case others haven't heard, @irenjj is working on additional subquery support as part of a Google Summer of Code Project (where @jayzhan211 and I are helping mentor).

    I am not quite sure what our next steps will be here

  6. alamb commented on May 18, 2025

    @alamb
    ContributorAuthor

    Update:

    I think the first thing we will be focusing on is a more general framework for decorrelation

  7. alamb commented on Jun 13, 2025

    @alamb
    ContributorAuthor

    I have seen @irenjj / @duongcongtoai / @UBarney / @jonathanc-n working on this

    @xudong963 (a DataFusion committer and PMC member) has experience in this area and may have additional time to help out, coordinate and review PRs.

  8. xudong963 commented on Jun 15, 2025

    @xudong963
    Member

    FYI, I just followed the latest paper from TUM, "Improving Unnesting of Complex Queries", and will learn about the current code in DF and read the latest PRs in DF about unnesting subquery

  9. alamb commented on Jun 16, 2025

    @alamb
    ContributorAuthor

    FYI, I just followed the latest paper from TUM, "Improving Unnesting of Complex Queries", and will learn about the current code in DF and read the latest PRs in DF about unnesting subquery

    Since I think DataBend is open source https://github.com/databendlabs/databend perhaps you can point us at the relevant code in that codebase that would be a good source of study?

  10. xudong963 commented on Jun 16, 2025

    @xudong963
    Member

    Since I think DataBend is open source https://github.com/databendlabs/databend perhaps you can point us at the relevant code in that codebase that would be a good source of study?

    Sure, the dir contains all subquery unnesting code: https://github.com/databendlabs/databend/tree/main/src/query/sql/src/planner/optimizer/optimizers/operator/decorrelate

    And this is the entry point of SubqueryDecorrelatorOptimizer rule: https://github.com/databendlabs/databend/blob/main/src/query/sql/src/planner/optimizer/optimizers/operator/decorrelate/subquery_decorrelator.rs#L802

  11. irenjj commented on Jun 17, 2025

    @irenjj
    Contributor

    Thanks @xudong963 and @alamb , we are trying to follow DuckDB's implementation: transform dependent join, flatten dependent join, eliminate delimjoin. I will spend time this weekend looking at Databend's implementation, maybe this will bring new ideas!

  12. xudong963 commented on Jun 18, 2025

    @xudong963
    Member

    DuckDB's implementation: transform dependent join, flatten dependent join, eliminate delimjoin

    I believe we're almost same, expect the implementation of datebend doesn't define dependent join explicitly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions