Skip to content

Commit

Permalink
planner: fix extract correlated column for expand in building phase w…
Browse files Browse the repository at this point in the history
…ill panic. (#54988) (#55031)

close #54983
  • Loading branch information
ti-chi-bot committed Jul 30, 2024
1 parent e0bf652 commit 31fb9de
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/planner/core/logical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,15 @@ func (p *LogicalExpand) ExtractFD() *fd.FDSet {

// ExtractCorrelatedCols implements LogicalPlan interface.
func (p *LogicalExpand) ExtractCorrelatedCols() []*expression.CorrelatedColumn {
// if p.LevelExprs is nil, it means the GenLevelProjections has not been called yet,
// which is done in logical optimizing phase. While for building correlated subquery
// plan, the ExtractCorrelatedCols will be called once after building, so we should
// distinguish the case here.
if p.LevelExprs == nil {
// since level projections generation don't produce any correlated columns, just
// return nil.
return nil
}
corCols := make([]*expression.CorrelatedColumn, 0, len(p.LevelExprs[0]))
for _, lExpr := range p.LevelExprs {
for _, expr := range lExpr {
Expand Down

0 comments on commit 31fb9de

Please sign in to comment.