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

bindinfo: extract the table hint from the union statement #50070

Merged
merged 5 commits into from
Jan 4, 2024

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Jan 4, 2024

What problem does this PR solve?

Issue Number: close #50068

Problem Summary:

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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

Signed-off-by: Weizhen Wang <[email protected]>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 4, 2024
Copy link

codecov bot commented Jan 4, 2024

Codecov Report

Merging #50070 (06da976) into master (ebe334f) will increase coverage by 10.1064%.
Report is 8 commits behind head on master.
The diff coverage is 76.9230%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #50070         +/-   ##
=================================================
+ Coverage   71.9162%   82.0227%   +10.1064%     
=================================================
  Files          1439       2444       +1005     
  Lines        346158     674601     +328443     
=================================================
+ Hits         248944     553326     +304382     
- Misses        76967     100559      +23592     
- Partials      20247      20716        +469     
Flag Coverage Δ
integration 48.8525% <72.7272%> (?)
unit 79.3527% <76.9230%> (+7.4364%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 73.6130% <ø> (+17.3001%) ⬆️
parser ∅ <ø> (∅)
br 71.9208% <ø> (+20.4493%) ⬆️

Signed-off-by: Weizhen Wang <[email protected]>
Signed-off-by: Weizhen Wang <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 4, 2024
Signed-off-by: Weizhen Wang <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 4, 2024
Signed-off-by: Weizhen Wang <[email protected]>
@hawkingrei hawkingrei changed the title bindinfo: fix the Extract bindinfo: extract the table hint from the union statement Jan 4, 2024
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. and removed do-not-merge/needs-triage-completed labels Jan 4, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 4, 2024
@@ -88,6 +88,18 @@ func ExtractTableHintsFromStmtNode(node ast.Node, sctx sessionctx.Context) []*as
// check duplicated hints
checkInsertStmtHintDuplicated(node, sctx)
return x.TableHints
case *ast.SetOprStmt:
var result []*ast.TableOptimizerHint
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to preallocate here? Might it not be worth it because usually we only have a few hints?

Copy link
Member Author

Choose a reason for hiding this comment

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

It‘s hard to know how much memory do we need to allocate.

BTW, Many statements are without hint so preallocate is unnecessary.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 4, 2024
Copy link

ti-chi-bot bot commented Jan 4, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-04 08:11:54.357231991 +0000 UTC m=+2331005.394458907: ☑️ agreed by qw4990.
  • 2024-01-04 08:32:31.826952637 +0000 UTC m=+2332242.864179565: ☑️ agreed by hi-rustin.

return nil
}
for _, s := range x.SelectList.Selects {
tmp := ExtractTableHintsFromStmtNode(s, sctx)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can call it hints?

Copy link
Contributor

@elsa0520 elsa0520 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Jan 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, elsa0520, hi-rustin, qw4990

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [AilinKid,elsa0520,hi-rustin,qw4990]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hawkingrei
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 62c83d4 into pingcap:master Jan 4, 2024
22 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #50095.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #50096.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #50097.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

planner: set_var cannot take effect in UNION ALL statements
6 participants