Skip to content
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 hash_join_build and hash_join_probe hints #36667

Merged
merged 19 commits into from Sep 2, 2022

Conversation

Reminiscent
Copy link
Contributor

@Reminiscent Reminiscent commented Jul 28, 2022

What problem does this PR solve?

Issue Number: close #35439

Problem Summary:
support hash_join_build and hash_join_probe hints

What is changed and how it works?

  1. Handle the hint in the plan builder phase for every query block.
  2. Set the hint to join node when build the join node.
  3. Generate the special hash join plan in the physical optimize phase.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@Reminiscent Reminiscent added the sig/planner SIG: Planner label Jul 28, 2022
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 28, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Yisaer
  • qw4990

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 28, 2022
@Reminiscent
Copy link
Contributor Author

wait for #36615

@sre-bot
Copy link
Contributor

sre-bot commented Jul 28, 2022

@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 9, 2022
@Reminiscent Reminiscent marked this pull request as ready for review August 9, 2022 02:59
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2022
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 29, 2022
@Reminiscent Reminiscent changed the title planner: support hash_build and hash_probe hints planner: support hash_join_build and hash_join_probe hints Aug 29, 2022
Copy link
Contributor

@Yisaer Yisaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

Comment on lines +401 to +406
if !forceLeftToBuild {
joins = append(joins, p.getHashJoin(prop, 1, false))
}
if !forceRightToBuild {
joins = append(joins, p.getHashJoin(prop, 1, true))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not

if forceLeftToBuild {
	joins = append(joins, p.getHashJoin(prop, 1, true))
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because when we not use the hints, we should get both. If we use if forceLeftToBuild, we will not get the hash join when we not set the hints.

Comment on lines +412 to +417
if !forceLeftToBuild {
joins = append(joins, p.getHashJoin(prop, 0, true))
}
if !forceRightToBuild {
joins = append(joins, p.getHashJoin(prop, 0, false))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 1, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 1, 2022
@Reminiscent
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1955

2 similar comments
@Reminiscent
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1955

@Reminiscent
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1955

@Reminiscent
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1957

@Reminiscent
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1957

@Reminiscent
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 97197e6

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 2, 2022
@ti-chi-bot
Copy link
Member

@Reminiscent: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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.

@Reminiscent
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1957

@ti-chi-bot ti-chi-bot merged commit 57c4938 into pingcap:master Sep 2, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Sep 2, 2022

TiDB MergeCI notify

🔴 Bad News! New failing [2] after this pr merged.
These new failed integration tests seem to be caused by the current PR, please try to fix these new failed integration tests, thanks!

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/common-test 🟥 failed 1, success 10, total 11 13 min New failing
idc-jenkins-ci-tidb/integration-common-test 🟥 failed 4, success 13, total 17 13 min New failing
idc-jenkins-ci/integration-cdc-test 🟢 all 37 tests passed 25 min Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 14 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 5 min 33 sec Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 5 min 21 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 4 min 45 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 23 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 2 min 53 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

planner: support hash_build and hash_probe hint
5 participants