Skip to content

Commit

Permalink
[parser] parser: implement Restore for DropStatsStmt (pingcap#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
TennyZhuang authored and leoppro committed Dec 21, 2018
1 parent 435b0c9 commit de39b1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion parser/ast/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ type DropStatsStmt struct {

// Restore implements Node interface.
func (n *DropStatsStmt) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented")
ctx.WriteKeyWord("DROP STATS ")
if err := n.Table.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while add table")
}

return nil
}

// Accept implements Node Accept interface.
Expand Down
2 changes: 1 addition & 1 deletion parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ func (s *testParserSuite) TestDDL(c *C) {
{"drop view xxx, yyy", true, ""},
{"drop view if exists xxx", true, ""},
{"drop view if exists xxx, yyy", true, ""},
{"drop stats t", true, ""},
{"drop stats t", true, "DROP STATS `t`"},
// for issue 974
{`CREATE TABLE address (
id bigint(20) NOT NULL AUTO_INCREMENT,
Expand Down

0 comments on commit de39b1a

Please sign in to comment.