-
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 paired joins for left semi inverted joins #55986
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.
Reviewed 7 of 7 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @sumeerbhola)
pkg/sql/opt/xform/join_funcs.go, line 467 at r1 (raw file):
continuationCol := opt.ColumnID(0) invertedJoinType := joinType // Anti/semi joins are converted to a pair consisting of a left join and
is there any way we can use an inner join for the first join when the second is a semi join?
pkg/sql/opt/xform/rules/join.opt, line 151 at r1 (raw file):
# custom function for more details. # TODO(rytaft): Add support for SemiJoin. Currently it is supported by first # converting it to InnerJoin using the rule ConvertSemiToInnerJoin.
remove TODO
5863460
to
e12a12a
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.
TFTR!
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft)
pkg/sql/opt/xform/join_funcs.go, line 467 at r1 (raw file):
Previously, rytaft (Rebecca Taft) wrote…
is there any way we can use an inner join for the first join when the second is a semi join?
That was silly of me. I thought I'd forgotten to add support for a continuation column for inner joins, but I had actually added that for exactly this reason (and it's even explained in the comment for InvertedJoinerSpec
).
Done.
pkg/sql/opt/xform/rules/join.opt, line 151 at r1 (raw file):
Previously, rytaft (Rebecca Taft) wrote…
remove TODO
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.
Reviewed 6 of 6 files at r2.
Reviewable status: complete! 1 of 0 LGTMs obtained
pkg/sql/opt/xform/join_funcs.go, line 475 at r2 (raw file):
[nit] maybe rename this function to just be PairedJoin instead of PairedLeftJoin |
e12a12a
to
c6dc1db
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! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft)
pkg/sql/opt/xform/join_funcs.go, line 475 at r2 (raw file):
Previously, rytaft (Rebecca Taft) wrote…
[nit] maybe rename this function to just be PairedJoin instead of PairedLeftJoin
The original intention was for "left join" to refer to the overall join (which is a left semi/anti/outer join). But I see why this can be confusing. I've renamed it as you suggested, and added a sentence to the function comment.
c6dc1db
to
d0e2a47
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.
Reviewed 1 of 1 files at r3.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale)
Semi joins using the inverted index used to be converted to an inner inverted join followed by an inner lookup join and a distinct for de-duplication. They are now converted to paired-joins consisting of an inner inverted join followed by a left semi lookup join, which is more efficient. Release note: None
d0e2a47
to
dd16fc3
Compare
Don't forget to update the PR message to change left outer -> inner |
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.
Thanks for the reminder. Done. I wish it would sync from the commit message for a single commit PR.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft)
Yea... that would be nice |
bors r+ |
Build succeeded: |
Semi joins using the inverted index used to be converted
to an inner inverted join followed by an inner lookup join
and a distinct for de-duplication. They are now converted
to paired-joins consisting of an inner inverted join
followed by a left semi lookup join, which is more
efficient.
Release note: None