-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
opt: use equalities to constrain inverted join prefix columns #58222
opt: use equalities to constrain inverted join prefix columns #58222
Conversation
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner, @RaduBerinde, and @rytaft)
pkg/sql/opt/xform/join_funcs.go, line 484 at r1 (raw file):
// Only calculate the left and right equality columns if there is a // multi-column inverted index. if numPrefixCols > 0 && leftEqCols == nil {
[nit] maybe add a eqColsCalculated
bool, because ExtractJoinEqualityColumns
can return nil
pkg/sql/opt/xform/join_funcs.go, line 497 at r1 (raw file):
// constraints and computed column expressions. var constFilters memo.FiltersExpr for i, n := 0, numPrefixCols; i < n; i++ {
we don't need n
n-ymore
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.
Reviewed 2 of 2 files at r1.
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @mgartner)
67c6d0d
to
426c4b3
Compare
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.
Reviewable status: complete! 2 of 0 LGTMs obtained
pkg/sql/opt/xform/join_funcs.go, line 484 at r1 (raw file):
Previously, RaduBerinde wrote…
[nit] maybe add a
eqColsCalculated
bool, becauseExtractJoinEqualityColumns
can return nil
Good catch. Done.
pkg/sql/opt/xform/join_funcs.go, line 497 at r1 (raw file):
Previously, RaduBerinde wrote…
we don't need
n
n-ymore
😆 Done.
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft)
426c4b3
to
48cc523
Compare
TFTRs! bors r+ |
Build failed: |
bors r+ |
58222: opt: use equalities to constrain inverted join prefix columns r=mgartner a=mgartner Non-inverted prefix columns can now be constrained by equality constraints to generate inverted joins. For example, an inverted join is now generated for the following query: CREATE TABLE a (a INT, j JSON) CREATE TABLE b (b INT, j JSON, INVERTED INDEX (b, j)) SELECT * FROM a JOIN b ON b = a AND b.j @> a.j Previously, only constant filters could constrain non-inverted prefix columns. Release note: None Co-authored-by: Marcus Gartner <[email protected]>
Build failed: |
Non-inverted prefix columns can now be constrained by equality constraints to generate inverted joins. For example, an inverted join is now generated for the following query: CREATE TABLE a (a INT, j JSON) CREATE TABLE b (b INT, j JSON, INVERTED INDEX (b, j)) SELECT * FROM a JOIN b ON b = a AND b.j @> a.j Previously, only constant filters could constrain non-inverted prefix columns. Release note: None
48cc523
to
b0db256
Compare
bors r+ |
Build succeeded: |
Non-inverted prefix columns can now be constrained by equality
constraints to generate inverted joins. For example, an inverted join is
now generated for the following query:
Previously, only constant filters could constrain non-inverted prefix
columns.
Release note: None