Skip to content

parser: add SHOW RAW IMPORT JOB(S)#67521

Open
GMHDBJD wants to merge 3 commits intopingcap:masterfrom
GMHDBJD:pr-66502-parser
Open

parser: add SHOW RAW IMPORT JOB(S)#67521
GMHDBJD wants to merge 3 commits intopingcap:masterfrom
GMHDBJD:pr-66502-parser

Conversation

@GMHDBJD
Copy link
Copy Markdown
Contributor

@GMHDBJD GMHDBJD commented Apr 2, 2026

What problem does this PR solve?

Issue Number: ref #66461

Problem Summary:

This PR extracts the parser-related part from #66502 so the syntax and AST changes for SHOW RAW IMPORT JOB(S) can be reviewed separately.

What changed and how does it work?

  • Add parser support for SHOW RAW IMPORT JOB <job_id> and SHOW RAW IMPORT JOBS.
  • Add ImportJobRaw to ast.ShowStmt and restore the RAW prefix in SQL text.
  • Add parser coverage for the new syntax and update keyword metadata/tests for RAW.
  • Regenerate parser artifacts on top of current master.
  • Follow-up PRs will wire planner, executor, and import SDK behavior.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Added parser support for `SHOW RAW IMPORT JOB(S)`.

Summary by CodeRabbit

  • New Features

    • Added support for SHOW RAW IMPORT JOB(S) (e.g., SHOW RAW IMPORT JOBS, SHOW RAW IMPORT JOB ), enabling raw-format import job output.
    • Parser now recognizes RAW as a valid keyword so RAW can be used in import-job queries.
  • Tests

    • Extended test coverage for SHOW RAW IMPORT JOBS variants: listing, single-job lookup, and filtered queries.

(cherry picked from commit 3b7155d)
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Apr 2, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Apr 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5ac8a0d3-0086-47e1-825a-da6c722fb4b9

📥 Commits

Reviewing files that changed from the base of the PR and between 0aac5bb and c4c9867.

📒 Files selected for processing (2)
  • pkg/parser/parser.go
  • pkg/parser/parser.y

📝 Walkthrough

Walkthrough

Adds parsing and AST support for the SQL variants prefixed by RAW: SHOW RAW IMPORT JOB and SHOW RAW IMPORT JOBS. Introduces an ImportJobRaw flag in the AST, registers RAW as a keyword/token, updates grammar to parse RAW-prefixed forms, and extends tests and restore output.

Changes

Cohort / File(s) Summary
AST & Tests
pkg/parser/ast/dml.go, pkg/parser/ast/dml_test.go
Added ImportJobRaw bool to ShowStmt; Restore now emits RAW when set. Added test cases for SHOW RAW IMPORT JOBS, SHOW RAW IMPORT JOB <id>, and a filtered WHERE variant.
Keyword Registration & Token Map
pkg/parser/keywords.go, pkg/parser/misc.go, pkg/parser/keywords_test.go
Registered RAW as a non-reserved TiDB keyword, added "RAW" -> raw entry to tokenMap, and updated keyword count assertion (677 → 678).
Parser Grammar
pkg/parser/parser.y
Extended SHOW parsing with ShowImportJobTarget / ShowImportJobsTarget to accept optional RAW and set ImportJobRaw on constructed ShowStmt; minor formatting/alignment edits in nearby productions.

Sequence Diagram(s)

sequenceDiagram
    participant Client as SQL Input
    participant Lexer
    participant Parser
    participant AST as AST Builder

    Client->>Lexer: "SHOW RAW IMPORT JOBS"
    Lexer->>Parser: tokens: SHOW, RAW, IMPORT, JOBS
    Parser->>Parser: match ShowImportJobsTarget (RAW IMPORT JOBS)
    Parser->>AST: construct ShowStmt{Tp: ShowImportJobs, ImportJobRaw: true}
    AST-->>Client: ShowStmt(ImportJobRaw=true)

    Client->>Lexer: "SHOW RAW IMPORT JOB 123 WHERE group_key='g'"
    Lexer->>Parser: tokens: SHOW, RAW, IMPORT, JOB, 123, WHERE, IDENT, '=', STRING
    Parser->>Parser: match ShowImportJobTarget + Int64Num + filter
    Parser->>AST: construct ShowStmt{Tp: ShowImportJobs, ImportJobID: 123, ImportJobRaw: true, Filter: ...}
    AST-->>Client: ShowStmt(ImportJobID=123, ImportJobRaw=true, Filter=...)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • breezewish
  • yudongusa
  • bb7133
  • hawkingrei
  • lance6716

Poem

🐰 I hopped through tokens in the dew,
Spotted RAW letters, shiny and new,
I twitched my nose, parsed with delight,
AST paws tapped through day and night,
Tests cheered — tiny rabbit hops anew!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding parser support for the SHOW RAW IMPORT JOB(S) syntax, which is the primary focus of this parser-focused PR.
Description check ✅ Passed The description follows the template structure with issue reference, problem summary, clear explanation of changes, completed checklist items, and a release note. All critical sections are present and appropriately filled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ti-chi-bot ti-chi-bot bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 2, 2026
@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 2, 2026

Hi @GMHDBJD. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD GMHDBJD marked this pull request as ready for review April 2, 2026 10:48
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 2, 2026
@pantheon-ai
Copy link
Copy Markdown

pantheon-ai bot commented Apr 2, 2026

Review Complete

Findings: 0 issues
Posted: 0
Duplicates/Skipped: 0

ℹ️ Learn more details on Pantheon AI.

Copy link
Copy Markdown

@pantheon-ai pantheon-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Code looks good. No issues found.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/parser/ast/dml.go (1)

3434-3443: ⚠️ Potential issue | 🟠 Major

Propagate restoreShowLikeOrWhereOpt() errors in the SHOW ... IMPORT JOBS restore path.

At Line 3442, the returned error is ignored. This can silently mask restore failures for both RAW and non-RAW SHOW IMPORT JOBS.

Suggested fix
 		} else {
 			ctx.WriteKeyWord("IMPORT JOBS")
-			restoreShowLikeOrWhereOpt()
+			if err := restoreShowLikeOrWhereOpt(); err != nil {
+				return err
+			}
 		}

As per coding guidelines, keep error handling actionable and contextual; avoid silently swallowing errors.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/parser/ast/dml.go` around lines 3434 - 3443, The SHOW IMPORT JOBS restore
path currently calls restoreShowLikeOrWhereOpt() and ignores its error; update
the call site so you capture the returned error from
restoreShowLikeOrWhereOpt(), and if non-nil return (or wrap with contextual
message) up the call stack instead of discarding it; ensure the surrounding
function (the restore/format method that contains the ctx.WriteKeyWord("IMPORT
JOBS") logic) propagates the error to the caller so restore failures for RAW and
non-RAW paths aren't silently swallowed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@pkg/parser/ast/dml.go`:
- Around line 3434-3443: The SHOW IMPORT JOBS restore path currently calls
restoreShowLikeOrWhereOpt() and ignores its error; update the call site so you
capture the returned error from restoreShowLikeOrWhereOpt(), and if non-nil
return (or wrap with contextual message) up the call stack instead of discarding
it; ensure the surrounding function (the restore/format method that contains the
ctx.WriteKeyWord("IMPORT JOBS") logic) propagates the error to the caller so
restore failures for RAW and non-RAW paths aren't silently swallowed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 26dad9b9-101e-4c0c-b29c-8353c70e3505

📥 Commits

Reviewing files that changed from the base of the PR and between 4d20c4a and e1d0743.

📒 Files selected for processing (7)
  • pkg/parser/ast/dml.go
  • pkg/parser/ast/dml_test.go
  • pkg/parser/keywords.go
  • pkg/parser/keywords_test.go
  • pkg/parser/misc.go
  • pkg/parser/parser.go
  • pkg/parser/parser.y

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.4063%. Comparing base (8b8bccf) to head (c4c9867).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #67521        +/-   ##
================================================
- Coverage   77.5921%   77.4063%   -0.1859%     
================================================
  Files          1981       1965        -16     
  Lines        548142     548618       +476     
================================================
- Hits         425315     424665       -650     
- Misses       122017     123951      +1934     
+ Partials        810          2       -808     
Flag Coverage Δ
integration 41.1288% <ø> (+6.7891%) ⬆️
unit 76.6412% <100.0000%> (+0.2956%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 61.5065% <ø> (ø)
parser ∅ <ø> (∅)
br 49.9076% <ø> (-10.5212%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ingress-bot
Copy link
Copy Markdown

🔍 Starting code review for this PR...

Copy link
Copy Markdown

@ingress-bot ingress-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was generated by AI and should be verified by a human reviewer.
Manual follow-up is recommended before merge.

Summary

  • Total findings: 1
  • Inline comments: 1
  • Summary-only findings (no inline anchor): 0
Findings (highest risk first)

⚠️ [Major] (1)

  1. ImportJobRaw flag silently dropped at plan-build time — SHOW RAW behaves as SHOW (pkg/parser/ast/dml.go:3209, pkg/planner/core/planbuilder.go:3498, pkg/executor/builder.go:930, pkg/planner/core/operator/logicalop/logical_show.go:61)

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Apr 3, 2026
@ingress-bot
Copy link
Copy Markdown

🔍 Processing follow-up on review comments...

Copy link
Copy Markdown
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

ImportJobID: &v,
}
}
| "SHOW" "RAW" "IMPORT" "JOB" Int64Num
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we merge the rule with above, so we can decode RAW as optional

below "RAW" "IMPORT" "JOBS" too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored this into helper nonterminals in parser.y so both SHOW RAW IMPORT JOB <id> and SHOW RAW IMPORT JOBS reuse the same optional-RAW structure without introducing parser conflicts. Updated in 0aac5bb.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 3, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Apr 3, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-04-03 08:13:05.851522181 +0000 UTC m=+511991.056882228: ☑️ agreed by lance6716.
  • 2026-04-03 09:27:49.658422346 +0000 UTC m=+516474.863782403: ☑️ agreed by D3Hunter.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 3, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 3, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 3, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 3, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

1 similar comment
@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown

@yudongusa yudongusa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link the document PR

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Apr 8, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, lance6716, yudongusa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Apr 8, 2026
@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 8, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 8, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 10, 2026

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Apr 10, 2026

@GMHDBJD: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 10, 2026

/retest

@hawkingrei
Copy link
Copy Markdown
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Apr 10, 2026
@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 10, 2026

/retest

2 similar comments
@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 10, 2026

/retest

@GMHDBJD
Copy link
Copy Markdown
Contributor Author

GMHDBJD commented Apr 11, 2026

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants