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
6 changes: 6 additions & 0 deletions parser/ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,12 @@ type Limit struct {
Offset ExprNode
}

// LimitSimple is the simple version for Limit.
type LimitSimple struct {
Count uint64
Offset uint64
}

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
5 changes: 5 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 @@ -2125,6 +2126,7 @@ type AdminStmt struct {
Plugins []string
Where ExprNode
StatementScope StatementScope
LimitSimple LimitSimple
}

// Restore implements Node interface.
Expand Down Expand Up @@ -2219,6 +2221,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