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 the view hint #38653

Merged
merged 22 commits into from
Nov 14, 2022
Merged

Conversation

Reminiscent
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #37887

Problem Summary:
Support the view hint

What is changed and how it works?

You can see the design doc for more details.

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 Oct 26, 2022
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 26, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • fzzf678
  • 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 Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 26, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 26, 2022
@@ -4941,7 +4966,7 @@ func (b *PlanBuilder) checkRecursiveView(dbName model.CIStr, tableName model.CIS
}

// BuildDataSourceFromView is used to build LogicalPlan from view
func (b *PlanBuilder) BuildDataSourceFromView(ctx context.Context, dbName model.CIStr, tableInfo *model.TableInfo) (LogicalPlan, error) {
func (b *PlanBuilder) BuildDataSourceFromView(ctx context.Context, dbName model.CIStr, tableInfo *model.TableInfo, qbNameMap4View map[string][]ast.HintTable, viewHints map[string][]*ast.TableOptimizerHint) (LogicalPlan, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add some comments for qbNameMap4View and viewHints.

QbHints map[int][]*ast.TableOptimizerHint // Group all hints at same query block.
QbHints4View map[string][]*ast.TableOptimizerHint
Copy link
Contributor

Choose a reason for hiding this comment

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

Is QbHints4View[QBName] equal to QBHints[QBNameMap[QBName]]?


for qbName, viewQbNameHint := range qbNameMap4View {
selectOffset := -1
viewQbNameHint = viewQbNameHint[1:]
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to move this pop-operation to buildDataSource.


hintProcessor.QbNameMap4View = qbNameMap4View
hintProcessor.QbHints4View = viewHints
hintProcessor.QbHints = currentQbHints
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we merge them here instead of replacing QbHints with curQbHints?
QbHints = curQbHints --> QbHints += curQbHints?

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 10, 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 Nov 14, 2022
@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: cc09a5d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 14, 2022
@fzzf678
Copy link
Contributor

fzzf678 commented Nov 14, 2022

/run-check_dev_2

@ti-chi-bot ti-chi-bot merged commit a8f56ee into pingcap:master Nov 14, 2022
@Reminiscent Reminiscent deleted the view-hint1 branch November 14, 2022 04:09
@Reminiscent Reminiscent restored the view-hint1 branch November 14, 2022 04:13
@sre-bot
Copy link
Contributor

sre-bot commented Nov 14, 2022

TiDB MergeCI notify

✅ Well Done! New fixed [1] after this pr merged.

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/mybatis-test 🔴 failed 1, success 0, total 1 11 min Existing failure
idc-jenkins-ci-tidb/integration-ddl-test ✅ all 6 tests passed 4 min 53 sec Fixed
idc-jenkins-ci/integration-cdc-test 🟢 all 39 tests passed 23 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 17 tests passed 16 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 11 tests passed 12 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 7 min 25 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 7 min 4 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 5 min 43 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 3 min 12 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

@Reminiscent Reminiscent mentioned this pull request Nov 15, 2022
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. 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.

Optimizer hints is not worked for views
6 participants