morningman opened a new pull request, #63823:
URL: https://github.com/apache/doris/pull/63823

   ## Summary
   
   Split SQL syntax parsing out of `fe-core` into a new `fe-sql-parser` module 
that produces an ANTLR parse tree (CST) without semantic analysis. The new 
module can be packaged as an independent jar for external consumers 
(third-party tools, linters, format converters, etc.) without dragging in 
`LogicalPlan`, `Catalog`, `ConnectContext`, or any other fe-core internals.
   
   - Move `DorisLexer.g4` / `DorisParser.g4` and 8 supporting Java files 
(`CaseInsensitiveStream`, `Origin`, `ParserUtils`, `ParseErrorListener`, 
`PostProcessor`, `ParseException`, `SyntaxParseException`, 
`QueryParsingErrors`) into `fe-sql-parser`. Package names are preserved so 
fe-core's hundreds of imports do not move.
   - `ParseException` now extends `RuntimeException` directly to break the 
chain through `nereids.exceptions.AnalysisException`, which references 
`LogicalPlan`. `ParserUtils` drops its `MoreFieldsThread` fast path; the new 
module does not carry fe-core thread-local context.
   - Add `org.apache.doris.sqlparser.DorisSqlParser` facade with 
`parseStatement` / `parseStatements` / `parseExpression`.
   - fe-core reverse-depends on fe-sql-parser; its own `antlr4-maven-plugin` 
now only processes the Nereids pattern-generator's `JavaLexer.g4` / 
`JavaParser.g4`.
   
   The new module's only runtime dependency is `org.antlr:antlr4-runtime`.
   
   ## Test plan
   
   - [x] `fe-sql-parser` unit tests: 7 new cases in `DorisSqlParserTest` 
covering SELECT, SELECT FROM WHERE, multi-statement, expression, DDL (CREATE 
TABLE with DISTRIBUTED + PROPERTIES), malformed SQL, and trailing-garbage 
expressions
   - [x] Full `fe` reactor compiles (`mvn -pl fe-core -am compile`)
   - [x] fe-core's 15 existing `org.apache.doris.nereids.parser.*Test` classes 
pass (160 cases, 0 failures)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to