andygrove opened a new pull request, #2996:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2996

   Dialects: none
   
   **Experimental, not ready to merge.** I am experimenting with how the v2 
parser proposed in #2893 could be added incrementally, without breaking changes 
to the existing AST. I am opening this to get feedback on the approach.
   
   The first commit adds the v2 parser to the workspace as a separate crate, 
`sqlparser_v2`. `sqlparser` does not depend on it in that commit.
   
   The second commit adds an opt-in `v2` feature. `sqlparser::v2::parse_sql` 
parses with v2 and converts the result to the existing AST, so callers can try 
the new parser without changing their code. Nothing changes for users who do 
not enable the feature. `GenericDialect` and `AnsiDialect` have no v2 
equivalent and are rejected. Only queries are converted so far. Anything else 
fails with `Error::Unconverted`, and `parse_sql_with_fallback` retries those 
with the existing parser. `compare` runs both parsers, for checking a 
downstream test suite against v2.
   
   `tests/sqlparser_v2.rs` runs every statement in v2's corpus through both 
parsers in each dialect. 14,640 conversions produce the same AST as the 
existing parser. 307 differ because the two parsers read the SQL differently, 
and are listed in `tests/v2_known_differences.txt`. The test fails on a new 
difference, or if the number of matching conversions drops. With PostgreSQL, v2 
plus the conversion is 1.4x to 2.3x faster than the existing parser 
(`sqlparser_bench/benches/v2_bridge.rs`).
   
   The code in this PR was written by Claude (Claude Code). The design is mine, 
and I understand it well, but I have not reviewed every line of the code.
   


-- 
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