Skip to content

Commit c3bdffe

Browse files
crazycs520bb7133
authored andcommitted
*: add show table regions syntax (#349) (#384)
1 parent 52a9d3a commit c3bdffe

File tree

4 files changed

+2999
-2943
lines changed

4 files changed

+2999
-2943
lines changed

ast/dml.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,7 @@ const (
18271827
ShowDrainerStatus
18281828
ShowOpenTables
18291829
ShowAnalyzeStatus
1830+
ShowRegions
18301831
)
18311832

18321833
const (
@@ -1852,7 +1853,8 @@ type ShowStmt struct {
18521853
DBName string
18531854
Table *TableName // Used for showing columns.
18541855
Column *ColumnName // Used for `desc table column`.
1855-
Flag int // Some flag parsed from sql, such as FULL.
1856+
IndexName model.CIStr
1857+
Flag int // Some flag parsed from sql, such as FULL.
18561858
Full bool
18571859
User *auth.UserIdentity // Used for show grants/create user.
18581860
Roles []*auth.RoleIdentity // Used for show grants .. using
@@ -2088,6 +2090,17 @@ func (n *ShowStmt) Restore(ctx *RestoreCtx) error {
20882090
ctx.WriteKeyWord("DRAINER STATUS")
20892091
case ShowAnalyzeStatus:
20902092
ctx.WriteKeyWord("ANALYZE STATUS")
2093+
case ShowRegions:
2094+
ctx.WriteKeyWord("TABLE ")
2095+
if err := n.Table.Restore(ctx); err != nil {
2096+
return errors.Annotate(err, "An error occurred while restore SplitIndexRegionStmt.Table")
2097+
}
2098+
if len(n.IndexName.L) > 0 {
2099+
ctx.WriteKeyWord(" INDEX ")
2100+
ctx.WriteName(n.IndexName.String())
2101+
}
2102+
ctx.WriteKeyWord(" REGIONS")
2103+
return nil
20912104
default:
20922105
return errors.New("Unknown ShowStmt type")
20932106
}

0 commit comments

Comments
 (0)