Skip to content

Commit

Permalink
parser: add support of 'ADMIN SHOW DDL JOB QUERIES LIMIT m OFFSET n' …
Browse files Browse the repository at this point in the history
…transferring to AST (pingcap#36285)

ref pingcap#36198
  • Loading branch information
lyzx2001 authored Jul 22, 2022
1 parent bf743a6 commit eaead02
Show file tree
Hide file tree
Showing 4 changed files with 5,102 additions and 5,028 deletions.
11 changes: 11 additions & 0 deletions parser/ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,7 @@ const (
AdminCleanupIndex
AdminCheckIndexRange
AdminShowDDLJobQueries
AdminShowDDLJobQueriesWithRange
AdminChecksumTable
AdminShowSlow
AdminShowNextRowID
Expand Down Expand Up @@ -2118,6 +2119,12 @@ func (n *ShowSlow) Restore(ctx *format.RestoreCtx) error {
return nil
}

// LimitSimple is the struct for Admin statement limit option.
type LimitSimple struct {
Count uint64
Offset uint64
}

// AdminStmt is the struct for Admin statement.
type AdminStmt struct {
stmtNode
Expand All @@ -2133,6 +2140,7 @@ type AdminStmt struct {
Plugins []string
Where ExprNode
StatementScope StatementScope
LimitSimple LimitSimple
}

// Restore implements Node interface.
Expand Down Expand Up @@ -2227,6 +2235,9 @@ func (n *AdminStmt) Restore(ctx *format.RestoreCtx) error {
case AdminShowDDLJobQueries:
ctx.WriteKeyWord("SHOW DDL JOB QUERIES ")
restoreJobIDs()
case AdminShowDDLJobQueriesWithRange:
ctx.WriteKeyWord("SHOW DDL JOB QUERIES LIMIT ")
ctx.WritePlainf("%d, %d", n.LimitSimple.Offset, n.LimitSimple.Count)
case AdminShowSlow:
ctx.WriteKeyWord("SHOW SLOW ")
if err := n.ShowSlow.Restore(ctx); err != nil {
Expand Down
Loading

0 comments on commit eaead02

Please sign in to comment.