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: move logical apply to logicalop pkg. #55370

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/planner/cascades/implementation_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ func (*ImplApply) Match(expr *memo.GroupExpr, prop *property.PhysicalProperty) (

// OnImplement implements ImplementationRule OnImplement interface
func (*ImplApply) OnImplement(expr *memo.GroupExpr, reqProp *property.PhysicalProperty) ([]memo.Implementation, error) {
la := expr.ExprNode.(*plannercore.LogicalApply)
la := expr.ExprNode.(*logicalop.LogicalApply)
join := plannercore.GetHashJoin(la, reqProp)
physicalApply := plannercore.PhysicalApply{
PhysicalHashJoin: *join,
Expand Down
6 changes: 3 additions & 3 deletions pkg/planner/cascades/transformation_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -2444,7 +2444,7 @@ func NewRuleTransformApplyToJoin() Transformation {

// OnTransform implements Transformation interface.
func (r *TransformApplyToJoin) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {
apply := old.GetExpr().ExprNode.(*plannercore.LogicalApply)
apply := old.GetExpr().ExprNode.(*logicalop.LogicalApply)
groupExpr := old.GetExpr()
// It's safe to use the old apply instead of creating a new LogicalApply here,
// Because apply.CorCols will only be used and updated by this rule during Transformation.
Expand Down Expand Up @@ -2502,15 +2502,15 @@ func NewRulePullSelectionUpApply() Transformation {
// This rule tries to pull up the inner side Selection, and add these conditions
// to Join condition inside the Apply.
func (*PullSelectionUpApply) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {
apply := old.GetExpr().ExprNode.(*plannercore.LogicalApply)
apply := old.GetExpr().ExprNode.(*logicalop.LogicalApply)
outerChildGroup := old.Children[0].Group
innerChildGroup := old.Children[1].Group
sel := old.Children[1].GetExpr().ExprNode.(*logicalop.LogicalSelection)
newConds := make([]expression.Expression, 0, len(sel.Conditions))
for _, cond := range sel.Conditions {
newConds = append(newConds, cond.Clone().Decorrelate(outerChildGroup.Prop.Schema))
}
newApply := plannercore.LogicalApply{
newApply := logicalop.LogicalApply{
LogicalJoin: *(apply.LogicalJoin.Shallow()),
CorCols: apply.CorCols,
}.Init(apply.SCtx(), apply.QueryBlockOffset())
Expand Down
1 change: 0 additions & 1 deletion pkg/planner/core/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ go_library(
"indexmerge_path.go",
"indexmerge_unfinished_path.go",
"initialize.go",
"logical_apply.go",
"logical_cte.go",
"logical_datasource.go",
"logical_expand.go",
Expand Down
2 changes: 1 addition & 1 deletion pkg/planner/core/casetest/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestGroupNDVs(t *testing.T) {
join = v
lp = v.Children()[0]
stack = append(stack, v.Children()[1])
case *core.LogicalApply:
case *logicalop.LogicalApply:
lp = lp.Children()[0]
stack = append(stack, v.Children()[1])
case *core.LogicalUnionAll:
Expand Down
2 changes: 1 addition & 1 deletion pkg/planner/core/collect_column_stats_usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (c *columnStatsUsageCollector) collectFromPlan(lp base.LogicalPlan) {
}
case *logicalop.LogicalJoin:
c.collectPredicateColumnsForJoin(x)
case *LogicalApply:
case *logicalop.LogicalApply:
c.collectPredicateColumnsForJoin(&x.LogicalJoin)
// Assume statistics of correlated columns are needed.
// Correlated columns can be found in LogicalApply.Children()[0].Schema(). Since we already visit LogicalApply.Children()[0],
Expand Down
1 change: 1 addition & 0 deletions pkg/planner/core/core_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func init() {
utilfuncp.ExhaustPhysicalPlans4LogicalTopN = exhaustPhysicalPlans4LogicalTopN
utilfuncp.ExhaustPhysicalPlans4LogicalLock = exhaustPhysicalPlans4LogicalLock
utilfuncp.ExhaustPhysicalPlans4LogicalJoin = exhaustPhysicalPlans4LogicalJoin
utilfuncp.ExhaustPhysicalPlans4LogicalApply = exhaustPhysicalPlans4LogicalApply
utilfuncp.ExhaustPhysicalPlans4LogicalLimit = exhaustPhysicalPlans4LogicalLimit
utilfuncp.ExhaustPhysicalPlans4LogicalWindow = exhaustPhysicalPlans4LogicalWindow
utilfuncp.ExhaustPhysicalPlans4LogicalSequence = exhaustPhysicalPlans4LogicalSequence
Expand Down
11 changes: 7 additions & 4 deletions pkg/planner/core/exhaust_physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -2224,12 +2224,13 @@ func MatchItems(p *property.PhysicalProperty, items []*util.ByItems) bool {
}

// GetHashJoin is public for cascades planner.
func GetHashJoin(la *LogicalApply, prop *property.PhysicalProperty) *PhysicalHashJoin {
func GetHashJoin(la *logicalop.LogicalApply, prop *property.PhysicalProperty) *PhysicalHashJoin {
return getHashJoin(&la.LogicalJoin, prop, 1, false)
}

// ExhaustPhysicalPlans4LogicalApply generates the physical plan for a logical apply.
func ExhaustPhysicalPlans4LogicalApply(la *LogicalApply, prop *property.PhysicalProperty) ([]base.PhysicalPlan, bool, error) {
// exhaustPhysicalPlans4LogicalApply generates the physical plan for a logical apply.
func exhaustPhysicalPlans4LogicalApply(lp base.LogicalPlan, prop *property.PhysicalProperty) ([]base.PhysicalPlan, bool, error) {
la := lp.(*logicalop.LogicalApply)
if !prop.AllColsFromSchema(la.Children()[0].Schema()) || prop.IsFlashProp() { // for convenient, we don't pass through any prop
la.SCtx().GetSessionVars().RaiseWarningWhenMPPEnforced(
"MPP mode may be blocked because operator `Apply` is not supported now.")
Expand All @@ -2243,7 +2244,9 @@ func ExhaustPhysicalPlans4LogicalApply(la *LogicalApply, prop *property.Physical
join := GetHashJoin(la, prop)
var columns = make([]*expression.Column, 0, len(la.CorCols))
for _, colColumn := range la.CorCols {
columns = append(columns, &colColumn.Column)
// fix the liner warning.
tmp := colColumn
columns = append(columns, &tmp.Column)
}
cacheHitRatio := 0.0
if la.StatsInfo().RowCount != 0 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5063,7 +5063,7 @@ func (b *PlanBuilder) buildProjUponView(_ context.Context, dbName model.CIStr, t
// every row from outerPlan and the whole innerPlan.
func (b *PlanBuilder) buildApplyWithJoinType(outerPlan, innerPlan base.LogicalPlan, tp logicalop.JoinType, markNoDecorrelate bool) base.LogicalPlan {
b.optFlag = b.optFlag | flagPredicatePushDown | flagBuildKeyInfo | flagDecorrelate | flagConvertOuterToInnerJoin
ap := LogicalApply{LogicalJoin: logicalop.LogicalJoin{JoinType: tp}, NoDecorrelate: markNoDecorrelate}.Init(b.ctx, b.getSelectOffset())
ap := logicalop.LogicalApply{LogicalJoin: logicalop.LogicalJoin{JoinType: tp}, NoDecorrelate: markNoDecorrelate}.Init(b.ctx, b.getSelectOffset())
ap.SetChildren(outerPlan, innerPlan)
ap.SetOutputNames(make([]*types.FieldName, outerPlan.Schema().Len()+innerPlan.Schema().Len()))
copy(ap.OutputNames(), outerPlan.OutputNames())
Expand Down Expand Up @@ -5092,7 +5092,7 @@ func (b *PlanBuilder) buildSemiApply(outerPlan, innerPlan base.LogicalPlan, cond
}

setIsInApplyForCTE(innerPlan, join.Schema())
ap := &LogicalApply{LogicalJoin: *join, NoDecorrelate: markNoDecorrelate}
ap := &logicalop.LogicalApply{LogicalJoin: *join, NoDecorrelate: markNoDecorrelate}
ap.SetTP(plancodec.TypeApply)
ap.SetSelf(ap)
return ap, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/planner/core/logical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
_ base.LogicalPlan = &logicalop.LogicalAggregation{}
_ base.LogicalPlan = &logicalop.LogicalProjection{}
_ base.LogicalPlan = &logicalop.LogicalSelection{}
_ base.LogicalPlan = &LogicalApply{}
_ base.LogicalPlan = &logicalop.LogicalApply{}
_ base.LogicalPlan = &logicalop.LogicalMaxOneRow{}
_ base.LogicalPlan = &logicalop.LogicalTableDual{}
_ base.LogicalPlan = &DataSource{}
Expand Down
3 changes: 3 additions & 0 deletions pkg/planner/core/operator/logicalop/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go_library(
srcs = [
"base_logical_plan.go",
"logical_aggregation.go",
"logical_apply.go",
"logical_cte_table.go",
"logical_join.go",
"logical_limit.go",
Expand Down Expand Up @@ -43,6 +44,8 @@ go_library(
"//pkg/planner/funcdep",
"//pkg/planner/property",
"//pkg/planner/util",
"//pkg/planner/util/coreusage",
"//pkg/planner/util/fixcontrol",
"//pkg/planner/util/optimizetrace",
"//pkg/planner/util/optimizetrace/logicaltrace",
"//pkg/planner/util/utilfuncp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package core
package logicalop

import (
"github.com/pingcap/tidb/pkg/expression"
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tidb/pkg/planner/core/base"
"github.com/pingcap/tidb/pkg/planner/core/operator/logicalop"
fd "github.com/pingcap/tidb/pkg/planner/funcdep"
"github.com/pingcap/tidb/pkg/planner/property"
"github.com/pingcap/tidb/pkg/planner/util/coreusage"
"github.com/pingcap/tidb/pkg/planner/util/fixcontrol"
"github.com/pingcap/tidb/pkg/planner/util/optimizetrace"
"github.com/pingcap/tidb/pkg/planner/util/optimizetrace/logicaltrace"
"github.com/pingcap/tidb/pkg/planner/util/utilfuncp"
"github.com/pingcap/tidb/pkg/types"
"github.com/pingcap/tidb/pkg/util/plancodec"
)

// LogicalApply gets one row from outer executor and gets one row from inner executor according to outer row.
type LogicalApply struct {
logicalop.LogicalJoin
LogicalJoin

CorCols []*expression.CorrelatedColumn
// NoDecorrelate is from /*+ no_decorrelate() */ hint.
Expand All @@ -41,7 +41,7 @@ type LogicalApply struct {

// Init initializes LogicalApply.
func (la LogicalApply) Init(ctx base.PlanContext, offset int) *LogicalApply {
la.BaseLogicalPlan = logicalop.NewBaseLogicalPlan(ctx, plancodec.TypeApply, &la, offset)
la.BaseLogicalPlan = NewBaseLogicalPlan(ctx, plancodec.TypeApply, &la, offset)
return &la
}

Expand Down Expand Up @@ -76,7 +76,7 @@ func (la *LogicalApply) PruneColumns(parentUsedCols []*expression.Column, opt *o
leftCols, rightCols := la.ExtractUsedCols(parentUsedCols)
allowEliminateApply := fixcontrol.GetBoolWithDefault(la.SCtx().GetSessionVars().GetOptimizerFixControlMap(), fixcontrol.Fix45822, true)
var err error
if allowEliminateApply && rightCols == nil && la.JoinType == logicalop.LeftOuterJoin {
if allowEliminateApply && rightCols == nil && la.JoinType == LeftOuterJoin {
logicaltrace.ApplyEliminateTraceStep(la.Children()[1], opt)
resultPlan := la.Children()[0]
// reEnter the new child's column pruning, returning child[0] as a new child here.
Expand Down Expand Up @@ -134,7 +134,7 @@ func (la *LogicalApply) DeriveStats(childStats []*property.StatsInfo, selfSchema
for id, c := range leftProfile.ColNDVs {
la.StatsInfo().ColNDVs[id] = c
}
if la.JoinType == logicalop.LeftOuterSemiJoin || la.JoinType == logicalop.AntiLeftOuterSemiJoin {
if la.JoinType == LeftOuterSemiJoin || la.JoinType == AntiLeftOuterSemiJoin {
la.StatsInfo().ColNDVs[selfSchema.Columns[selfSchema.Len()-1].UniqueID] = 2.0
} else {
for i := childSchema[0].Len(); i < selfSchema.Len(); i++ {
Expand All @@ -149,7 +149,7 @@ func (la *LogicalApply) DeriveStats(childStats []*property.StatsInfo, selfSchema
func (la *LogicalApply) ExtractColGroups(colGroups [][]*expression.Column) [][]*expression.Column {
var outerSchema *expression.Schema
// Apply doesn't have RightOuterJoin.
if la.JoinType == logicalop.LeftOuterJoin || la.JoinType == logicalop.LeftOuterSemiJoin || la.JoinType == logicalop.AntiLeftOuterSemiJoin {
if la.JoinType == LeftOuterJoin || la.JoinType == LeftOuterSemiJoin || la.JoinType == AntiLeftOuterSemiJoin {
outerSchema = la.Children()[0].Schema()
}
if len(colGroups) == 0 || outerSchema == nil {
Expand All @@ -170,7 +170,7 @@ func (la *LogicalApply) ExtractColGroups(colGroups [][]*expression.Column) [][]*

// ExhaustPhysicalPlans implements base.LogicalPlan.<14th> interface.
func (la *LogicalApply) ExhaustPhysicalPlans(prop *property.PhysicalProperty) ([]base.PhysicalPlan, bool, error) {
return ExhaustPhysicalPlans4LogicalApply(la, prop)
return utilfuncp.ExhaustPhysicalPlans4LogicalApply(la, prop)
}

// ExtractCorrelatedCols implements base.LogicalPlan.<15th> interface.
Expand Down Expand Up @@ -221,11 +221,11 @@ func (la *LogicalApply) ExtractFD() *fd.FDSet {
}
}
switch la.JoinType {
case logicalop.InnerJoin:
case InnerJoin:
return la.ExtractFDForInnerJoin(eqCond)
case logicalop.LeftOuterJoin, logicalop.RightOuterJoin:
case LeftOuterJoin, RightOuterJoin:
return la.ExtractFDForOuterJoin(eqCond)
case logicalop.SemiJoin:
case SemiJoin:
return la.ExtractFDForSemiJoin(eqCond)
default:
return &fd.FDSet{HashCodeToUniqueID: make(map[string]int)}
Expand All @@ -240,7 +240,7 @@ func (la *LogicalApply) ExtractFD() *fd.FDSet {

// CanPullUpAgg checks if an apply can pull an aggregation up.
func (la *LogicalApply) CanPullUpAgg() bool {
if la.JoinType != logicalop.InnerJoin && la.JoinType != logicalop.LeftOuterJoin {
if la.JoinType != InnerJoin && la.JoinType != LeftOuterJoin {
return false
}
if len(la.EqualConditions)+len(la.LeftConditions)+len(la.RightConditions)+len(la.OtherConditions) > 0 {
Expand Down Expand Up @@ -280,7 +280,7 @@ func (la *LogicalApply) DeCorColFromEqExpr(expr expression.Expression) expressio
}

func (la *LogicalApply) getGroupNDVs(colGroups [][]*expression.Column, childStats []*property.StatsInfo) []property.GroupNDV {
if len(colGroups) > 0 && (la.JoinType == logicalop.LeftOuterSemiJoin || la.JoinType == logicalop.AntiLeftOuterSemiJoin || la.JoinType == logicalop.LeftOuterJoin) {
if len(colGroups) > 0 && (la.JoinType == LeftOuterSemiJoin || la.JoinType == AntiLeftOuterSemiJoin || la.JoinType == LeftOuterJoin) {
return childStats[0].GroupNDVs
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/planner/core/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func HasMaxOneRow(p base.LogicalPlan, childMaxOneRow []bool) bool {
}
switch x := p.(type) {
case *logicalop.LogicalLock, *logicalop.LogicalLimit, *logicalop.LogicalSort, *logicalop.LogicalSelection,
*LogicalApply, *logicalop.LogicalProjection, *logicalop.LogicalWindow, *logicalop.LogicalAggregation:
*logicalop.LogicalApply, *logicalop.LogicalProjection, *logicalop.LogicalWindow, *logicalop.LogicalAggregation:
return childMaxOneRow[0]
case *logicalop.LogicalMaxOneRow:
return true
Expand Down
14 changes: 7 additions & 7 deletions pkg/planner/core/rule_decorrelate.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (*DecorrelateSolver) aggDefaultValueMap(agg *logicalop.LogicalAggregation)
// Optimize implements base.LogicalOptRule.<0th> interface.
func (s *DecorrelateSolver) Optimize(ctx context.Context, p base.LogicalPlan, opt *optimizetrace.LogicalOptimizeOp) (base.LogicalPlan, bool, error) {
planChanged := false
if apply, ok := p.(*LogicalApply); ok {
if apply, ok := p.(*logicalop.LogicalApply); ok {
outerPlan := apply.Children()[0]
innerPlan := apply.Children()[1]
apply.CorCols = coreusage.ExtractCorColumnsBySchema4LogicalPlan(apply.Children()[1], apply.Children()[0].Schema())
Expand Down Expand Up @@ -393,7 +393,7 @@ func (*DecorrelateSolver) Name() string {
return "decorrelate"
}

func appendApplySimplifiedTraceStep(p *LogicalApply, j *logicalop.LogicalJoin, opt *optimizetrace.LogicalOptimizeOp) {
func appendApplySimplifiedTraceStep(p *logicalop.LogicalApply, j *logicalop.LogicalJoin, opt *optimizetrace.LogicalOptimizeOp) {
action := func() string {
return fmt.Sprintf("%v_%v simplified into %v_%v", plancodec.TypeApply, p.ID(), plancodec.TypeJoin, j.ID())
}
Expand Down Expand Up @@ -433,7 +433,7 @@ func appendRemoveLimitTraceStep(limit *logicalop.LogicalLimit, opt *optimizetrac
opt.AppendStepToCurrent(limit.ID(), limit.TP(), reason, action)
}

func appendRemoveProjTraceStep(p *LogicalApply, proj *logicalop.LogicalProjection, opt *optimizetrace.LogicalOptimizeOp) {
func appendRemoveProjTraceStep(p *logicalop.LogicalApply, proj *logicalop.LogicalProjection, opt *optimizetrace.LogicalOptimizeOp) {
action := func() string {
return fmt.Sprintf("%v_%v removed from plan tree", proj.TP(), proj.ID())
}
Expand All @@ -443,7 +443,7 @@ func appendRemoveProjTraceStep(p *LogicalApply, proj *logicalop.LogicalProjectio
opt.AppendStepToCurrent(proj.ID(), proj.TP(), reason, action)
}

func appendMoveProjTraceStep(p *LogicalApply, np base.LogicalPlan, proj *logicalop.LogicalProjection, opt *optimizetrace.LogicalOptimizeOp) {
func appendMoveProjTraceStep(p *logicalop.LogicalApply, np base.LogicalPlan, proj *logicalop.LogicalProjection, opt *optimizetrace.LogicalOptimizeOp) {
action := func() string {
return fmt.Sprintf("%v_%v is moved as %v_%v's parent", proj.TP(), proj.ID(), np.TP(), np.ID())
}
Expand All @@ -463,7 +463,7 @@ func appendRemoveSortTraceStep(sort *logicalop.LogicalSort, opt *optimizetrace.L
opt.AppendStepToCurrent(sort.ID(), sort.TP(), reason, action)
}

func appendPullUpAggTraceStep(p *LogicalApply, np base.LogicalPlan, agg *logicalop.LogicalAggregation, opt *optimizetrace.LogicalOptimizeOp) {
func appendPullUpAggTraceStep(p *logicalop.LogicalApply, np base.LogicalPlan, agg *logicalop.LogicalAggregation, opt *optimizetrace.LogicalOptimizeOp) {
action := func() string {
return fmt.Sprintf("%v_%v pulled up as %v_%v's parent, and %v_%v's join type becomes %v",
agg.TP(), agg.ID(), np.TP(), np.ID(), p.TP(), p.ID(), p.JoinType.String())
Expand All @@ -475,7 +475,7 @@ func appendPullUpAggTraceStep(p *LogicalApply, np base.LogicalPlan, agg *logical
opt.AppendStepToCurrent(agg.ID(), agg.TP(), reason, action)
}

func appendAddProjTraceStep(p *LogicalApply, proj *logicalop.LogicalProjection, opt *optimizetrace.LogicalOptimizeOp) {
func appendAddProjTraceStep(p *logicalop.LogicalApply, proj *logicalop.LogicalProjection, opt *optimizetrace.LogicalOptimizeOp) {
action := func() string {
return fmt.Sprintf("%v_%v is added as %v_%v's parent", proj.TP(), proj.ID(), p.TP(), p.ID())
}
Expand All @@ -485,7 +485,7 @@ func appendAddProjTraceStep(p *LogicalApply, proj *logicalop.LogicalProjection,
opt.AppendStepToCurrent(proj.ID(), proj.TP(), reason, action)
}

func appendModifyAggTraceStep(outerPlan base.LogicalPlan, p *LogicalApply, agg *logicalop.LogicalAggregation, sel *logicalop.LogicalSelection,
func appendModifyAggTraceStep(outerPlan base.LogicalPlan, p *logicalop.LogicalApply, agg *logicalop.LogicalAggregation, sel *logicalop.LogicalSelection,
appendedGroupByCols *expression.Schema, appendedAggFuncs []*aggregation.AggFuncDesc,
eqCondWithCorCol []*expression.ScalarFunction, opt *optimizetrace.LogicalOptimizeOp) {
evalCtx := outerPlan.SCtx().GetExprCtx().GetEvalCtx()
Expand Down
2 changes: 1 addition & 1 deletion pkg/planner/core/rule_eliminate_projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (pe *ProjectionEliminator) eliminate(p base.LogicalPlan, replace map[string
switch x := p.(type) {
case *logicalop.LogicalJoin:
x.SetSchema(logicalop.BuildLogicalJoinSchema(x.JoinType, x))
case *LogicalApply:
case *logicalop.LogicalApply:
x.SetSchema(logicalop.BuildLogicalJoinSchema(x.JoinType, x))
default:
for _, dst := range p.Schema().Columns {
Expand Down
4 changes: 2 additions & 2 deletions pkg/planner/core/stringer.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func fdToString(in base.LogicalPlan, strs []string, idxs []int) ([]string, []int
}
case *DataSource:
strs = append(strs, "{"+x.FDs().String()+"}")
case *LogicalApply:
case *logicalop.LogicalApply:
strs = append(strs, "{"+x.FDs().String()+"}")
case *logicalop.LogicalJoin:
strs = append(strs, "{"+x.FDs().String()+"}")
Expand Down Expand Up @@ -160,7 +160,7 @@ func toString(in base.Plan, strs []string, idxs []int) ([]string, []int) {
r := x.RightJoinKeys[i].StringWithCtx(ectx, perrors.RedactLogDisable)
str += fmt.Sprintf("(%s,%s)", l, r)
}
case *LogicalApply, *PhysicalApply:
case *logicalop.LogicalApply, *PhysicalApply:
last := len(idxs) - 1
idx := idxs[last]
children := strs[idx:]
Expand Down
2 changes: 1 addition & 1 deletion pkg/planner/pattern/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const (
// GetOperand maps logical plan operator to Operand.
func GetOperand(p base.LogicalPlan) Operand {
switch p.(type) {
case *plannercore.LogicalApply:
case *logicalop.LogicalApply:
return OperandApply
case *logicalop.LogicalJoin:
return OperandJoin
Expand Down
2 changes: 1 addition & 1 deletion pkg/planner/pattern/pattern_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestGetOperand(t *testing.T) {
require.Equal(t, OperandAggregation, GetOperand(&logicalop.LogicalAggregation{}))
require.Equal(t, OperandProjection, GetOperand(&logicalop.LogicalProjection{}))
require.Equal(t, OperandSelection, GetOperand(&logicalop.LogicalSelection{}))
require.Equal(t, OperandApply, GetOperand(&plannercore.LogicalApply{}))
require.Equal(t, OperandApply, GetOperand(&logicalop.LogicalApply{}))
require.Equal(t, OperandMaxOneRow, GetOperand(&logicalop.LogicalMaxOneRow{}))
require.Equal(t, OperandTableDual, GetOperand(&logicalop.LogicalTableDual{}))
require.Equal(t, OperandDataSource, GetOperand(&plannercore.DataSource{}))
Expand Down
4 changes: 4 additions & 0 deletions pkg/planner/util/utilfuncp/func_pointer_misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ var ExhaustPhysicalPlans4LogicalJoin func(lp base.LogicalPlan, prop *property.Ph
var ExhaustPhysicalPlans4LogicalAggregation func(lp base.LogicalPlan, prop *property.PhysicalProperty) (
[]base.PhysicalPlan, bool, error)

// ExhaustPhysicalPlans4LogicalApply will be called by LogicalApply in logicalOp pkg.
var ExhaustPhysicalPlans4LogicalApply func(lp base.LogicalPlan, prop *property.PhysicalProperty) (
[]base.PhysicalPlan, bool, error)

// *************************************** physical op related *******************************************

// GetEstimatedProbeCntFromProbeParents will be called by BasePhysicalPlan in physicalOp pkg.
Expand Down