-
Notifications
You must be signed in to change notification settings - Fork 5.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
planner: support the view hint #38653
Conversation
[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. |
@@ -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) { |
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.
Please add some comments for qbNameMap4View
and viewHints
.
util/hint/hint_processor.go
Outdated
QbHints map[int][]*ast.TableOptimizerHint // Group all hints at same query block. | ||
QbHints4View map[string][]*ast.TableOptimizerHint |
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.
Is QbHints4View[QBName]
equal to QBHints[QBNameMap[QBName]]
?
planner/core/logical_plan_builder.go
Outdated
|
||
for qbName, viewQbNameHint := range qbNameMap4View { | ||
selectOffset := -1 | ||
viewQbNameHint = viewQbNameHint[1:] |
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.
Better to move this pop-operation to buildDataSource
.
|
||
hintProcessor.QbNameMap4View = qbNameMap4View | ||
hintProcessor.QbHints4View = viewHints | ||
hintProcessor.QbHints = currentQbHints |
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.
Should we merge them here instead of replacing QbHints
with curQbHints
?
QbHints = curQbHints
--> QbHints += curQbHints
?
/merge |
This pull request has been accepted and is ready to merge. Commit hash: cc09a5d
|
/run-check_dev_2 |
TiDB MergeCI notify✅ Well Done! New fixed [1] after this pr merged.
|
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
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.