`datafusion-cli` ignores `datafusion.sql_parser.recursion_limit`
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Describe the bug
`exec_and_print` in `datafusion-cli/src/exec.rs` parses statements with `DFParser::parse_sql_with_dialect`, which always uses the parser's built-in recursion limit (50). The session option `datafusion.sql_parser.recursion_limit` is read by `SessionState::sql_to_statement` (via `DFParserBuilder::with_recursion_limit`) but never by the CLI, so changing it has no effect there.
### To Reproduce
```sql
> SET datafusion.sql_parser.recursion_limit = 100;
> SELECT abs(abs(abs( ... 60 nested calls ... )));
SQL error: RecursionLimitExceeded (current limit: 50)
```
The same statement succeeds through `SessionContext::sql` with that option set.
### Expected behavior
The CLI parses with the session's `recursion_limit`, like `SessionState::sql_to_statement`.
### Additional context
Noticed while testing deeply nested expressions in `datafusion-cli`.
Contributor guide
Research direction
Start in datafusion-cli/src/exec.rs at exec_and_print and compare its parsing path with SessionState::sql_to_statement, especially DFParserBuilder::with_recursion_limit. Reproduce the nested-expression example after setting datafusion.sql_parser.recursion_limit to 100; done means the CLI uses that session option and no longer fails at the built-in limit of 50.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100