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: integrate hashEqual interface into LogicalPlan and expression.Expression. #55652

Merged
merged 20 commits into from
Aug 27, 2024
Prev Previous commit
Next Next commit
.
Signed-off-by: arenatlx <314806019@qq.com>
  • Loading branch information
AilinKid committed Aug 26, 2024
commit 87c990d00b4af5475d3fa86a07bc7bb37c4a9bfc
19 changes: 19 additions & 0 deletions pkg/planner/core/operator/logicalop/logical_projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (p LogicalProjection) Init(ctx base.PlanContext, qbOffset int) *LogicalProj

// *************************** start implementation of HashEquals interface ****************************

// Hash64 implements the base.Hash64.<0th> interface.
func (p *LogicalProjection) Hash64(h mutil.Hasher) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just a future example

// todo: LogicalSchemaProducer should implement HashEquals interface, otherwise, its self elements
// like schema and names are lost.
Expand All @@ -76,6 +77,24 @@ func (p *LogicalProjection) Hash64(h mutil.Hasher) {
h.HashBool(p.Proj4Expand)
}

// Equals implements the base.HashEquals.<1st> interface.
func (p *LogicalProjection) Equals(other *LogicalProjection) bool {
// todo: LogicalSchemaProducer should implement HashEquals interface, otherwise, its self elements
// like schema and names are lost.
if !p.LogicalSchemaProducer.Equals(&other.BaseLogicalPlan) {
return false
}
for i, one := range p.Exprs {
if !one.(memo.ScalarOperator[any]).Equals(other.Exprs[i]) {
return false
}
}
if p.CalculateNoDelay != other.CalculateNoDelay {
return false
}
return p.Proj4Expand == other.Proj4Expand
}

// *************************** start implementation of Plan interface **********************************

// ExplainInfo implements Plan interface.
Expand Down