Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/parser/ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -3205,7 +3205,8 @@ type ShowStmt struct {

ShowGroupKey string // Used for `SHOW IMPORT GROUP <GROUP_KEY>` syntax

ImportJobID *int64 // Used for `SHOW IMPORT JOB <ID>` syntax
ImportJobID *int64 // Used for `SHOW IMPORT JOB <ID>` syntax
ImportJobRaw bool // Used for `SHOW RAW IMPORT JOB(S)` syntax

DistributionJobID *int64 // Used for `SHOW DISTRIBUTION JOB <ID>` syntax
}
Expand Down Expand Up @@ -3430,6 +3431,9 @@ func (n *ShowStmt) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord(" PARTITION ")
ctx.WriteName(n.Partition.String())
case ShowImportJobs:
if n.ImportJobRaw {
ctx.WriteKeyWord("RAW ")
}
if n.ImportJobID != nil {
ctx.WriteKeyWord("IMPORT JOB ")
ctx.WritePlainf("%d", *n.ImportJobID)
Expand Down
12 changes: 12 additions & 0 deletions pkg/parser/ast/dml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,18 @@ func TestImportActions(t *testing.T) {
sourceSQL: "show import job 123",
expectSQL: "SHOW IMPORT JOB 123",
},
{
sourceSQL: "show raw import jobs",
expectSQL: "SHOW RAW IMPORT JOBS",
},
{
sourceSQL: "show raw import job 123",
expectSQL: "SHOW RAW IMPORT JOB 123",
},
{
sourceSQL: "show raw import jobs where group_key = 'g'",
expectSQL: "SHOW RAW IMPORT JOBS WHERE `group_key`=_UTF8MB4'g'",
},
{
sourceSQL: "show import jobs where aa > 1",
expectSQL: "SHOW IMPORT JOBS WHERE `aa`>1",
Expand Down
1 change: 1 addition & 0 deletions pkg/parser/keywords.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/parser/keywords_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestKeywords(t *testing.T) {
}

func TestKeywordsLength(t *testing.T) {
require.Equal(t, 678, len(parser.Keywords))
require.Equal(t, 679, len(parser.Keywords))

reservedNr := 0
for _, kw := range parser.Keywords {
Expand Down
1 change: 1 addition & 0 deletions pkg/parser/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ var tokenMap = map[string]int{
"QUICK": quick,
"RANGE": rangeKwd,
"RATE_LIMIT": rateLimit,
"RAW": raw,
"READ": read,
"READ_ONLY": readOnly,
"REAL": realType,
Expand Down
Loading
Loading