LucaCappelletti94 opened a new pull request, #2351: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2351
`parse_prefix` wraps `parse_expr_prefix_by_reserved_word` in `try_parse`, which speculatively dispatches `parse_not` for the `NOT` keyword. `parse_not`'s inner `parse_subexpr(UnaryNot)` infix-loops through `-`, hits the next `NOT` and recurses, so on chains like `SELECT x-not-b.x-not-b...` ending in a parse error every `NOT` segment re-walks the rest of the chain and `parse_not` is called 2^N - 1 times. Fix is a per-parse `BTreeSet<usize>` of token positions where the speculative `parse_not` already failed. Subsequent visits at the same position skip the speculation and fall back to identifier interpretation. | Input | Before | After | |-------|--------|-------| | 903 B cursed libFuzzer artifact | ~12 s | ~2.5 ms | | `SELECT x-not-b.` * 22 | ~11 s | ~1 ms | | `SELECT x-not-b.` * 30 | (too slow to measure) | ~1.5 ms | -- 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]
