-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Prototype for Join Ordering #18023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Prototype for Join Ordering #18023
Conversation
| /// A simple Vec-based map that uses Option<T> for sparse storage | ||
| /// Keys are never reused once removed | ||
| pub(crate) struct VecMap<V>(Vec<Option<V>>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if you heard about slab. It's the same as VecMap, but where you can reuse keys. However, I am unfamiliar with the process of pulling in external dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using slotmap at first and also wasn't sure about the dependencies. And since we are not deleting notes, I thought the vecmap suffices.
And I mostly wanted to test the API of the query graph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And since we are not deleting notes, I thought the vecmap suffices.
Aha okay, than i have nothing to add here :)
This is a draft PR to provide a basis for the discussion in issue #17719.
The main point of the PR is to get some experience for designing a JoinGraph structure. The PR pretends Datafusion already has a JoinGraph/QueryGraph implemented and tries to use its API for join order optimization.
It implements the closed form solution to calculating the optimal left-deep join tree developed by Ibaraki&Kameda: https://dl.acm.org/doi/pdf/10.1145/1270.1498
It is also presented here: https://youtu.be/CcUVvnYv7Hg?list=PLSE8ODhjZXjYCZfIbmEWH7f6MnYqyPwCE&t=1952
It can be used to obtain a reasonable join ordering in polynomial time or as a starting point for more sophisticated algorithms.