Skip to content

Commit

Permalink
add the new stmt: drop stats partition (#1177)
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 authored Mar 1, 2021
1 parent cc1bbd2 commit 267e02a
Show file tree
Hide file tree
Showing 4 changed files with 4,913 additions and 4,883 deletions.
12 changes: 11 additions & 1 deletion ast/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ func (n *AnalyzeTableStmt) Accept(v Visitor) (Node, bool) {
type DropStatsStmt struct {
stmtNode

Table *TableName
Table *TableName
PartitionNames []model.CIStr
}

// Restore implements Node interface.
Expand All @@ -184,6 +185,15 @@ func (n *DropStatsStmt) Restore(ctx *format.RestoreCtx) error {
return errors.Annotate(err, "An error occurred while add table")
}

if len(n.PartitionNames) != 0 {
ctx.WriteKeyWord(" PARTITION ")
}
for i, partition := range n.PartitionNames {
if i != 0 {
ctx.WritePlain(",")
}
ctx.WriteName(partition.O)
}
return nil
}

Expand Down
Loading

0 comments on commit 267e02a

Please sign in to comment.