Skip to content

Commit 9d1dd4d

Browse files
authored
parser: support the new sql to show table t1 distribution (#59820)
close #59886
1 parent 8e233a3 commit 9d1dd4d

File tree

8 files changed

+10496
-10434
lines changed

8 files changed

+10496
-10434
lines changed

pkg/parser/ast/dml.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,6 +3050,7 @@ const (
30503050
ShowCreateProcedure
30513051
ShowBinlogStatus
30523052
ShowReplicaStatus
3053+
ShowDistributions
30533054
)
30543055

30553056
const (
@@ -3394,6 +3395,16 @@ func (n *ShowStmt) Restore(ctx *format.RestoreCtx) error {
33943395
ctx.WriteKeyWord("BINDING_CACHE STATUS")
33953396
case ShowAnalyzeStatus:
33963397
ctx.WriteKeyWord("ANALYZE STATUS")
3398+
case ShowDistributions:
3399+
ctx.WriteKeyWord("TABLE ")
3400+
if err := n.Table.Restore(ctx); err != nil {
3401+
return errors.Annotate(err, "An error occurred while restore ShowStmt.Table")
3402+
}
3403+
ctx.WriteKeyWord(" DISTRIBUTIONS")
3404+
if err := restoreShowLikeOrWhereOpt(); err != nil {
3405+
return err
3406+
}
3407+
return nil
33973408
case ShowRegions:
33983409
ctx.WriteKeyWord("TABLE ")
33993410
if err := n.Table.Restore(ctx); err != nil {

pkg/parser/keywords.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/parser/keywords_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestKeywords(t *testing.T) {
3636
}
3737

3838
func TestKeywordsLength(t *testing.T) {
39-
require.Equal(t, 655, len(parser.Keywords))
39+
require.Equal(t, 656, len(parser.Keywords))
4040

4141
reservedNr := 0
4242
for _, kw := range parser.Keywords {

pkg/parser/misc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ var tokenMap = map[string]int{
342342
"DISK": disk,
343343
"DISTINCT": distinct,
344344
"DISTINCTROW": distinct,
345+
"DISTRIBUTIONS": distributions,
345346
"DIV": div,
346347
"DO": do,
347348
"DOT": dotType,

0 commit comments

Comments
 (0)