[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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: make group expression inherit logical plan & refine rule interface. #57782

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

AilinKid
Copy link
Contributor

What problem does this PR solve?

Issue Number: ref #51664

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: arenatlx <314806019@qq.com>
.
Signed-off-by: arenatlx <314806019@qq.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 28, 2024
Copy link
tiprow bot commented Nov 28, 2024

Hi @AilinKid. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

.
Signed-off-by: arenatlx <314806019@qq.com>
.
Signed-off-by: arenatlx <314806019@qq.com>
.
Signed-off-by: arenatlx <314806019@qq.com>
.
Signed-off-by: arenatlx <314806019@qq.com>
Copy link
codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 71.18644% with 17 lines in your changes missing coverage. Please review.

Project coverage is 73.5732%. Comparing base (924784a) to head (4d96d1b).
Report is 28 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57782        +/-   ##
================================================
+ Coverage   72.8642%   73.5732%   +0.7090%     
================================================
  Files          1677       1677                
  Lines        464210     469975      +5765     
================================================
+ Hits         338243     345776      +7533     
+ Misses       105090     103284      -1806     
- Partials      20877      20915        +38     
Flag Coverage Δ
integration 43.3664% <ø> (?)
unit 72.2766% <71.1864%> (+0.0165%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 45.2665% <ø> (-0.4191%) ⬇️

.
Signed-off-by: arenatlx <314806019@qq.com>
.
Signed-off-by: arenatlx <314806019@qq.com>
@hawkingrei hawkingrei self-requested a review November 29, 2024 03:38
)

// IBufStrWriter is interface facilitate quick writing string regardless of error handling and written len.
type IBufStrWriter interface {
Copy link
Member

Choose a reason for hiding this comment

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

IBufStrWriter This naming is a bit C++ style.

https://go.dev/doc/effective_go#interface-names

Interface names

By convention, one-method interfaces are named by the method name plus an -er suffix or similar modification to construct an agent noun: Reader, Writer, Formatter, CloseNotifier etc.

There are a number of such names and it's productive to honor them and the function names they capture. Read, Write, Close, Flush, String and so on have canonical signatures and meanings. To avoid confusion, don't give your method one of those names unless it has the same signature and meaning. Conversely, if your type implements a method with the same meaning as a method on a well-known type, give it the same name and signature; call your string-converter method String not ToString.

.
Signed-off-by: arenatlx <314806019@qq.com>
pkg/planner/cascades/memo/group.go Outdated Show resolved Hide resolved
pkg/planner/cascades/memo/group.go Outdated Show resolved Hide resolved
.
Signed-off-by: arenatlx <314806019@qq.com>
.
Signed-off-by: arenatlx <314806019@qq.com>
.
Signed-off-by: arenatlx <314806019@qq.com>
@@ -159,15 +153,15 @@ func NewBinder(p *pattern.Pattern, gE *memo.GroupExpression) *Binder {
// empty stack info, means the toppest loop.
// pre-set nil is for later alignment with the traceID indexing.
stackInfo: []*list.Element{},
holder: &GroupExprHolder{Cur: gE},
holder: gE,
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 directly keep the Logicalplan as the holder in here ?

Copy link
Contributor Author
@AilinKid AilinKid Nov 29, 2024

Choose a reason for hiding this comment

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

not possible, some unchanged holder should be able to be traced back to its original group when copying in, LogicalPlan couldn't do that

base2 "github.com/pingcap/tidb/pkg/planner/cascades/base"
"github.com/pingcap/tidb/pkg/planner/cascades/util"
"github.com/pingcap/tidb/pkg/planner/core/base"
"github.com/pingcap/tidb/pkg/planner/pattern"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we need to organize the old cascades struct into new one

Copy link
Contributor Author
@AilinKid AilinKid Nov 29, 2024

Choose a reason for hiding this comment

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

yes, we did, currently all old stuff have been moved from ./cascades into ./cascades/old pkg, cause we want to use cascades pkg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

}

// WriteString implements IBufStrWriter
func (sw *StrBuffer) WriteString(s string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need an extra package for strBufferWriter ? Just for add a assert in the test ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it's for simplicity. otherwise, we should add hint skipper like the below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

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 Dec 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: elsa0520

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:

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

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 2, 2024
Copy link
ti-chi-bot bot commented Dec 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-02 06:02:33.160689602 +0000 UTC m=+1048340.780344118: ☑️ agreed by elsa0520.

.
Signed-off-by: arenatlx <314806019@qq.com>
Signed-off-by: arenatlx <314806019@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants