[refactor](parser) Dispatch parser statements by first token - #66944
Open
morrySnow wants to merge 2 commits into
Open
[refactor](parser) Dispatch parser statements by first token#66944morrySnow wants to merge 2 commits into
morrySnow wants to merge 2 commits into
Conversation
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: `statementBase` grouped unrelated statement families into one ANTLR adaptive prediction decision. Split cross-prefix families and dispatch them through first-token-specific rules so the generated `statementBase()` changes from one `adaptivePredict` call to a direct `LA(1)` switch. Preserve all concrete statement alternatives and FE visitor behavior; parent CST Context compatibility is intentionally out of scope because the standalone parser CST is not a public API. Shared-host JMH rounds were excluded because they did not pass the predeclared noise gate, so this change does not claim an unverified wall-clock improvement.
### Release note
None
### Check List (For Author)
- Test: Unit Test and Manual test
- `./run-fe-ut.sh --run org.apache.doris.sqlparser.StatementBaseDispatchTest,org.apache.doris.sqlparser.DorisSqlParserTest,org.apache.doris.nereids.parser.NereidsParserTest`
- `DISABLE_BUILD_UI=ON ./build.sh --fe`
- Behavior changed: No
- Does this need documentation: No
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: Rename statement grammar rules to remove the redundant `supported` prefix. Use `*StatementDispatch` for first-token family dispatchers where the natural statement name is occupied, and update generated-parser accessors, FE visitors, encryption handling, and README examples. SQL grammar alternatives and semantics are unchanged.
### Release note
None
### Check List (For Author)
- Test: Unit Test and Manual test
- `./run-fe-ut.sh --run org.apache.doris.sqlparser.StatementBaseDispatchTest,org.apache.doris.sqlparser.DorisSqlParserTest,org.apache.doris.nereids.parser.NereidsParserTest`
- `mvn checkstyle:check -pl fe-core`
- `DISABLE_BUILD_UI=ON ./build.sh --fe`
- Behavior changed: No
- Does this need documentation: No
morrySnow
requested review from
924060929,
englefly and
starocean999
as code owners
August 19, 2026 08:22
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
statementBasepreviously grouped unrelated statement families into one ANTLR adaptive prediction decision. This PR splits cross-prefix families and dispatches them through first-token-specific rules, changing generatedstatementBase()from oneadaptivePredictcall to a directLA(1)switch. It also removes the redundantsupportedprefix from statement grammar rules and generated Context/visitor names; dispatcher rules use the*StatementDispatchsuffix where the natural statement name is already occupied. All concrete grammar alternatives and FE behavior are preserved. Parent CST Context compatibility is intentionally out of scope because the standalone parser CST is not a public API.Shared-host JMH rounds were rejected because they did not pass the predeclared noise gate, so this PR does not claim an unverified wall-clock improvement.
Release note
None
Check List (For Author)
./run-fe-ut.sh --run org.apache.doris.sqlparser.StatementBaseDispatchTest,org.apache.doris.sqlparser.DorisSqlParserTest,org.apache.doris.nereids.parser.NereidsParserTestmvn checkstyle:check -pl fe-coreDISABLE_BUILD_UI=ON ./build.sh --feCheck List (For Reviewer who merge this PR)