-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner: support push down broadcast cartesian join to TiFlash #25049
Conversation
* support cross broadcast join * save work * save work * support push down cartesian join to tiflash * enable cartesian push down by default * refine * fix * fix
…ition is not empty while the join type is not left/right (pingcap#24846) * support cross broadcast join * save work * save work * support push down cartesian join to tiflash * enable cartesian push down by default * refine * fix * fix * fix ci
Please follow PR Title Format:
Or if the count of mainly changed packages are more than 3, use
|
return nil | ||
} | ||
|
||
if len(p.EqualConditions) == 0 { | ||
if p.ctx.GetSessionVars().AllowCartesianBCJ < 1 || !useBCJ { |
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.
== 0 is more direct ?
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.
Fixed.
if (len(p.LeftConditions) != 0 && p.JoinType != LeftOuterJoin) || (len(p.RightConditions) != 0 && p.JoinType != RightOuterJoin) { | ||
return nil | ||
} |
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.
why add this?
a inner join cannot have leftConditions or rightConditions?
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.
Because TiFlash assuming leftConditions
only exists for left join
and rightConditions
only exists for right join
if (len(p.LeftConditions) != 0 && p.JoinType != LeftOuterJoin) || (len(p.RightConditions) != 0 && p.JoinType != RightOuterJoin) { | ||
return nil | ||
} |
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.
why add this?
a inner join cannot have leftConditions or rightConditions?
// AllowCartesianBCJ means allow broadcast CARTESIAN join, 0 means not allow, 1 means allow broadcast CARTESIAN join | ||
// but the table size should under the broadcast threshold, 2 means allow broadcast CARTESIAN join even if the table | ||
// size exceeds the broadcast threshold | ||
AllowCartesianBCJ int |
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.
sessioni level or instance level?
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.
session level.
"explain format = 'brief' select count(*) from fact_t join d1_t on fact_t.d1_k > d1_t.d1_k", | ||
"explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k > d1_t.d1_k", | ||
"explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k > d1_t.d1_k", | ||
"explain format = 'brief' select count(*) from fact_t where d1_k not in (select d1_k from d1_t)" |
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.
add some example for semi join?
LGTM |
/merge |
@fzhedu: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/LGTM |
@fzhedu: Please use GitHub review feature instead of For the reason we drop support to the commands, see also this page. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
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.
/LGTM
@fzhedu: Please use GitHub review feature instead of For the reason we drop support to the commands, see also this page. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: f892839
|
/run-check_dev_2 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.0 in PR #25106 |
What problem does this PR solve?
Issue Number: close pingcap/tiflash#1938
Problem Summary:
Currently, TiFlash does not support cartesian join, so TiDB will not push down cartesian join to TiFlash.
What is changed and how it works?
Proposal: xxx
What's Changed:
How it Works:
After pingcap/tiflash#2041 TiFlash will support cartesian join, so in TiDB, it will push down a broadcast cartesian join to TiFlash.
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
Release note