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

   `parse_prefix` speculatively interprets the next token as a reserved-word 
expression head and, on failure, falls back to treating it as an unreserved 
identifier. Both arms can independently recurse into the same downstream 
position, so inputs like `IF(current_time(current_time(...x` were re-walked at 
every level for 2^N total work. Each `parse_prefix` failure is now memoized by 
start position so the second visit short-circuits.
   
   Same family as #2344 and the speculative `NOT` prefix fix on 
`pathological-combined`. PostgreSQL, release build:
   
   | depth | size  | before | after |
   |-------|-------|--------|-------|
   | 10    | 134 B | 900ms  | 399us |
   | 15    | 199 B | >60s   | 110us |
   | 20    | 264 B | >60s   | 109us |
   | 25    | 329 B | >60s   | 126us |
   | 30    | 394 B | >60s   | 124us |
   
   Regression test in `tests/sqlparser_common.rs` runs the parse on a worker 
thread with a 5-second hang guard. Criterion bench under `sqlparser_bench` 
tracks perf at n=10/20/30.


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