comphead commented on code in PR #15644: URL: https://github.com/apache/datafusion/pull/15644#discussion_r2034066869
########## datafusion/sql/src/parser.rs: ########## @@ -469,17 +478,31 @@ impl<'a> DFParser<'a> { } _ => { // use sqlparser-rs parser - Ok(Statement::Statement(Box::from( - self.parser.parse_statement()?, - ))) + match self.parser.parse_statement() { + Ok(stmt) => Ok(Statement::Statement(Box::from(stmt))), + Err(ParserError::RecursionLimitExceeded) => { + Err(ParserError::ParserError(format!( + "recursion limit exceeded (current limit: {})", + self.recursion_limit + ))) + } + Err(e) => Err(e), + } } } } _ => { // use the native parser - Ok(Statement::Statement(Box::from( - self.parser.parse_statement()?, - ))) + match self.parser.parse_statement() { + Ok(stmt) => Ok(Statement::Statement(Box::from(stmt))), Review Comment: we probably can do this more concise sort of ``` self.parser.parse_statement().map( |stmt| Statement::Statement(Box::new(stmt)) ).map_err(|e| match e { ParserError::RecursionLimitExceeded => ParserError::ParserError(format!( "recursion limit exceeded (current limit: {})", self.recursion_limit )), other => other, }) ``` -- 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