Skip to content

Commit

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

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

// LogicalShowDDLJobs is for showing DDL job list.
Expand Down
7 changes: 4 additions & 3 deletions planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2928,10 +2928,11 @@ 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
// It depends on ShowPredicateExtractor now
buildPattern := true

switch show.Tp {
case ast.ShowDatabases, ast.ShowVariables, ast.ShowTables, ast.ShowColumns, ast.ShowTableStatus, ast.ShowCollation:
Expand All @@ -2940,7 +2941,7 @@ func (b *PlanBuilder) buildShow(ctx context.Context, show *ast.ShowStmt) (Plan,
}
if extractor := newShowBaseExtractor(*show); extractor.Extract() {
p.Extractor = extractor
p.buildPattern = false
buildPattern = false
}
case ast.ShowCreateTable, ast.ShowCreateSequence, ast.ShowPlacementForTable, ast.ShowPlacementForPartition:
var err error
Expand Down Expand Up @@ -3012,7 +3013,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.buildPattern {
if show.Pattern != nil && buildPattern {
show.Pattern.Expr = &ast.ColumnNameExpr{
Name: &ast.ColumnName{Name: p.OutputNames()[0].ColName},
}
Expand Down

0 comments on commit 1a25e10

Please sign in to comment.