Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[parser] *: support for the statement of "admin show tableName next r…
Browse files Browse the repository at this point in the history
…ow id" (pingcap#19)
zimulala authored and xhebox committed Oct 8, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b6cf317 commit 7f67c9f
Showing 5 changed files with 5,036 additions and 5,009 deletions.
1 change: 1 addition & 0 deletions parser/ast/misc.go
Original file line number Diff line number Diff line change
@@ -628,6 +628,7 @@ const (
AdminShowDDLJobQueries
AdminChecksumTable
AdminShowSlow
AdminShowNextRowID
)

// HandleRange represents a range where handle value >= Begin and < End.
1 change: 1 addition & 0 deletions parser/misc.go
Original file line number Diff line number Diff line change
@@ -358,6 +358,7 @@ var tokenMap = map[string]int{
"NAMES": names,
"NATIONAL": national,
"NATURAL": natural,
"NEXT_ROW_ID": next_row_id,
"NO": no,
"NO_WRITE_TO_BINLOG": noWriteToBinLog,
"NONE": none,
10,032 changes: 5,024 additions & 5,008 deletions parser/parser.go

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion parser/parser.y
Original file line number Diff line number Diff line change
@@ -442,6 +442,7 @@ import (
extract "EXTRACT"
getFormat "GET_FORMAT"
groupConcat "GROUP_CONCAT"
next_row_id "NEXT_ROW_ID"
inplace "INPLACE"
internal "INTERNAL"
min "MIN"
@@ -2911,7 +2912,7 @@ TiDBKeyword:
NotKeywordToken:
"ADDDATE" | "BIT_AND" | "BIT_OR" | "BIT_XOR" | "CAST" | "COPY" | "COUNT" | "CURTIME" | "DATE_ADD" | "DATE_SUB" | "EXTRACT" | "GET_FORMAT" | "GROUP_CONCAT"
| "INPLACE" | "INTERNAL" |"MIN" | "MAX" | "MAX_EXECUTION_TIME" | "NOW" | "RECENT" | "POSITION" | "SUBDATE" | "SUBSTRING" | "SUM" | "STD" | "STDDEV" | "STDDEV_POP" | "STDDEV_SAMP"
| "TIMESTAMPADD" | "TIMESTAMPDIFF" | "TOP" | "TRIM"
| "TIMESTAMPADD" | "TIMESTAMPDIFF" | "TOP" | "TRIM" | "NEXT_ROW_ID"

/************************************************************************************
*
@@ -5251,6 +5252,13 @@ AdminStmt:
JobNumber: $5.(int64),
}
}
| "ADMIN" "SHOW" TableName "NEXT_ROW_ID"
{
$$ = &ast.AdminStmt{
Tp: ast.AdminShowNextRowID,
Tables: []*ast.TableName{$3.(*ast.TableName)},
}
}
| "ADMIN" "CHECK" "TABLE" TableNameList
{
$$ = &ast.AdminStmt{
1 change: 1 addition & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
@@ -438,6 +438,7 @@ func (s *testParserSuite) TestDMLStmt(c *C) {
{"admin show ddl jobs -1;", false},
{"admin show ddl job queries 1", true},
{"admin show ddl job queries 1, 2, 3, 4", true},
{"admin show t1 next_row_id", true},
{"admin check table t1, t2;", true},
{"admin check index tableName idxName;", true},
{"admin check index tableName idxName (1, 2), (4, 5);", true},

0 comments on commit 7f67c9f

Please sign in to comment.