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: fix extract correlated column for expand in building phase will panic. (#54988) #55031

Merged
Merged
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
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