moshap-firebolt opened a new pull request, #2372: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2372
`parse_table_factor` speculatively parses `(...)` as a derived table; on failure it rewinds and falls through to `parse_table_and_joins`, which recurses back into `parse_table_factor` and re-attempts the same speculative parse at every deeper paren. Both arms walk the remaining chain, so on inputs like `SELECT 1 FROM ((((...` work doubles per level. Caching the position at which the speculative arm failed short-circuits the second descent. Measured on `GenericDialect` with `with_recursion_limit(256)`, release build: | N | Before | After | |----|---------|--------| | 10 | 20 ms | 57 us | | 20 | 820 ms | 119 us | | 25 | 2.8 s | 281 us | | 30 | 7.9 s | 345 us | -- 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]
