-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: arenatlx <314806019@qq.com>
Hi @AilinKid. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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. |
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
) | ||
|
||
// IBufStrWriter is interface facilitate quick writing string regardless of error handling and written len. | ||
type IBufStrWriter interface { |
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.
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.
@@ -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, |
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 directly keep the Logicalplan as the holder in here ?
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.
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" |
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.
Maybe we need to organize the old cascades struct into new one
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.
yes, we did, currently all old stuff have been moved from ./cascades into ./cascades/old pkg, cause we want to use cascades pkg
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.
} | ||
|
||
// WriteString implements IBufStrWriter | ||
func (sw *StrBuffer) WriteString(s string) { |
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.
Why do we need an extra package for strBufferWriter ? Just for add a assert in the test ?
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.
yes, it's for simplicity. otherwise, we should add hint skipper like the below
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.
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.
LGTM
[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 |
[LGTM Timeline notifier]Timeline:
|
Signed-off-by: arenatlx <314806019@qq.com>
What problem does this PR solve?
Issue Number: ref #51664
Problem Summary:
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.