alpaylan opened a new issue, #3001:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/3001
Nesting qualified calls to CEIL, FLOOR, SUBSTRING or TRIM doubles the parse
time per level, in every dialect. Before #2685 (0.63.0) the same input was
rejected in microseconds:
```
SELECT a.CEIL(a.CEIL(a.CEIL(x))) -- nested n levels
bytes main 0.63.0
n=16 136 113 ms 0.041 ms (rejected)
n=20 168 1.7 s 0.052 ms (rejected)
n=22 184 6.8 s 0.054 ms (rejected)
```
Same with `SELECT pg_catalog.floor(pg_catalog.floor(...(1.5)...))` (1.7 s at
20 levels). Unqualified `CEIL(CEIL(...))` and `a.f(a.f(...))` stay linear.
```rust
use sqlparser::{dialect::PostgreSqlDialect, parser::Parser};
let sql = format!("SELECT {}x{}", "a.CEIL(".repeat(22), ")".repeat(22));
Parser::parse_sql(&PostgreSqlDialect {}, &sql).unwrap(); // ~7 s
```
Tested on main 9429cd30 and crates.io 0.64.0 and 0.63.0.
Found with a coverage-guided performance fuzzer; I used AI assistance for
triage and verified every case above.
--
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]