alamb commented on code in PR #14756:
URL: https://github.com/apache/datafusion/pull/14756#discussion_r1970151516


##########
datafusion/sql/src/parser.rs:
##########
@@ -257,6 +257,9 @@ fn ensure_not_set<T>(field: &Option<T>, name: &str) -> 
Result<(), ParserError> {
     Ok(())
 }
 
+/// Same as `sqlparser`
+const DEFAULT_RECURSION_LIMIT: usize = 50;

Review Comment:
   I verified this is the same default: 
   
https://github.com/apache/datafusion-sqlparser-rs/blob/648efd7057d63c65b53eddc3d05cc89d5697d85c/src/parser/mod.rs#L187



##########
datafusion/core/src/execution/session_state.rs:
##########
@@ -483,12 +483,21 @@ impl SessionState {
                      MsSQL, ClickHouse, BigQuery, Ansi."
             )
         })?;
-        let mut statements = DFParser::parse_sql_with_dialect(sql, 
dialect.as_ref())?;
+
+        let recursion_limit = self.config.options().sql_parser.recursion_limit;
+
+        let mut statements = DFParser::parse_sql_with_dialect_limit(

Review Comment:
   The API for DFParser is already somewhat tough. 
   
   Rather than adding  a new method here, could you make this a builder style 
instead, so ths would look something like this?
   
   ```suggestion
           let mut statements = DFParser::new_with_dialect(sql, 
dialect.with_ref())
             .with_recursion_limit(recursion_limit)
             .parse_statements()
   ```



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to