Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: add support of 'ADMIN SHOW DDL JOB QUERIES LIMIT m OFFSET n' transferring to AST #36285

Merged
merged 12 commits into from
Jul 22, 2022
7 changes: 7 additions & 0 deletions parser/ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,13 @@ type Limit struct {
Offset ExprNode
}

type LimitSimple struct {
node

Count int64
Offset int64
}

xhebox marked this conversation as resolved.
Show resolved Hide resolved
// Restore implements Node interface.
func (n *Limit) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord("LIMIT ")
Expand Down
6 changes: 6 additions & 0 deletions parser/ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,7 @@ const (
AdminCleanupIndex
AdminCheckIndexRange
AdminShowDDLJobQueries
AdminShowDDLJobQueriesWithRange
AdminChecksumTable
AdminShowSlow
AdminShowNextRowID
Expand Down Expand Up @@ -2119,6 +2120,8 @@ type AdminStmt struct {
Tables []*TableName
JobIDs []int64
JobNumber int64
Limit int64
xhebox marked this conversation as resolved.
Show resolved Hide resolved
Offset int64

HandleRanges []HandleRange
ShowSlow *ShowSlow
Expand Down Expand Up @@ -2219,6 +2222,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.Offset, n.Limit)
case AdminShowSlow:
ctx.WriteKeyWord("SHOW SLOW ")
if err := n.ShowSlow.Restore(ctx); err != nil {
Expand Down
Loading