Skip to content

Commit

Permalink
add extra flag to determine to buildPattern or not
Browse files Browse the repository at this point in the history
  • Loading branch information
likzn committed Jun 24, 2022
1 parent b2283c1 commit 9778fcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion planner/core/logical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,8 @@ type LogicalShow struct {
logicalSchemaProducer
ShowContents

Extractor ShowPredicateExtractor
Extractor ShowPredicateExtractor
buildPattern bool // It depends on ShowPredicateExtractor now
}

// LogicalShowDDLJobs is for showing DDL job list.
Expand Down
4 changes: 3 additions & 1 deletion planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2928,6 +2928,7 @@ func (b *PlanBuilder) buildShow(ctx context.Context, show *ast.ShowStmt) (Plan,
GlobalScope: show.GlobalScope,
Extended: show.Extended,
},
buildPattern: true,
}.Init(b.ctx)
isView := false
isSequence := false
Expand All @@ -2939,6 +2940,7 @@ func (b *PlanBuilder) buildShow(ctx context.Context, show *ast.ShowStmt) (Plan,
}
if extractor := newShowBaseExtractor(*show); extractor.Extract() {
p.Extractor = extractor
p.buildPattern = false
}
case ast.ShowCreateTable, ast.ShowCreateSequence, ast.ShowPlacementForTable, ast.ShowPlacementForPartition:
var err error
Expand Down Expand Up @@ -3010,7 +3012,7 @@ func (b *PlanBuilder) buildShow(ctx context.Context, show *ast.ShowStmt) (Plan,
var np LogicalPlan
np = p
// If we have ShowPredicateExtractor, we do not buildSelection with Pattern
if show.Pattern != nil && p.Extractor == nil {
if show.Pattern != nil && p.buildPattern {
show.Pattern.Expr = &ast.ColumnNameExpr{
Name: &ast.ColumnName{Name: p.OutputNames()[0].ColName},
}
Expand Down

0 comments on commit 9778fcf

Please sign in to comment.