-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
gen4: Add hash join primitive and planning #9140
Conversation
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
aba6d46
to
719507b
Compare
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
We should hide this behind a planner hint until we are comfortable with it being used |
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
we can now use the |
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
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 would be interested to see 5-6 different kinds of queries in the end-to-end test.
Signed-off-by: Vicent Marti <[email protected]>
Signed-off-by: Vicent Marti <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
typ, err := CoerceTo(v1.Type(), v2.Type()) // TODO systay we should add a method where this decision is done at plantime | ||
if err != nil { | ||
return 0, err | ||
} | ||
v1cast, err := castTo(v1, typ) |
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.
based on the TODO,
what can at least be done is to pass the coerceTo value directly to the NullsafeCompare
method and calculate that once in the engine.
Signed-off-by: Andres Taylor <[email protected]>
@@ -28,37 +28,37 @@ var _ Primitive = (*Distinct)(nil) | |||
|
|||
// Distinct Primitive is used to uniqueify results | |||
type Distinct struct { | |||
Source Primitive | |||
Source Primitive | |||
ColCollations []collations.ID |
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.
We can use a map over here which can simplify the access and also prevent any index out of range errors easily.
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.
when executing things in the runtime, we want them as fast as possible. A map is actually slower than accessing a position by offset in a slice, so I'll keep the collations as a slice here
Signed-off-by: Andres Taylor <[email protected]>
…y on the hint for now Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Description
This PR adds hash joins to the alternatives that the gen4 planner can use when planning queries.
The current join algorithm is a nested loop join, also known as an Apply Join. It will run the query on the RHS of the join as many times as there are rows on the LHS. The complexity is
O(n*m)
. Hash Join will only run each query once, so the complexity isO(n+m)
Related Issue(s)
#7280
Checklist