alamb commented on code in PR #1464:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1464#discussion_r1803437297
##########
src/parser/mod.rs:
##########
@@ -3510,16 +3510,19 @@ impl<'a> Parser<'a> {
/// Run a parser method `f`, reverting back to the current position if
unsuccessful.
#[must_use]
- pub fn maybe_parse<T, F>(&mut self, mut f: F) -> Option<T>
+ pub fn maybe_parse<T, F>(&mut self, mut f: F) -> Result<Option<T>,
ParserError>
where
F: FnMut(&mut Parser) -> Result<T, ParserError>,
{
let index = self.index;
- if let Ok(t) = f(self) {
- Some(t)
- } else {
- self.index = index;
- None
+ match f(self) {
+ Ok(t) => Ok(Some(t)),
+ // Unwind stack if limit exceeded
+ Err(ParserError::RecursionLimitExceeded) =>
Err(ParserError::RecursionLimitExceeded),
Review Comment:
👍
##########
src/ast/mod.rs:
##########
@@ -3191,7 +3191,7 @@ pub enum Statement {
/// Table confs
options: Vec<SqlOption>,
/// Cache table as a Query
- query: Option<Query>,
+ query: Option<Box<Query>>,
Review Comment:
this is a nice change
##########
src/ast/query.rs:
##########
@@ -1103,7 +1103,7 @@ pub enum PivotValueSource {
/// Pivot on all values returned by a subquery.
///
/// See
<https://docs.snowflake.com/en/sql-reference/constructs/pivot#pivot-on-column-values-using-a-subquery-with-dynamic-pivot>.
- Subquery(Query),
+ Subquery(Box<Query>),
Review Comment:
👍
--
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]