iffyio commented on code in PR #1799:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1799#discussion_r2036518287


##########
src/parser/mod.rs:
##########
@@ -11823,7 +11828,16 @@ impl<'a> Parser<'a> {
                     }
                     _ => break,
                 };
-                let relation = self.parse_table_factor()?;
+                let mut relation = self.parse_table_factor()?;
+
+                if self.is_next_token_a_join() {
+                    let joins = self.parse_joins()?;
+                    relation = TableFactor::NestedJoin {
+                        table_with_joins: Box::new(TableWithJoins { relation, 
joins }),
+                        alias: None,
+                    };
+                }

Review Comment:
   Ah yeah so what I meant was that the current `parse_table_factor` gets 
renamed to something like `parse_table_factor_inner`, then the new impl 
`parse_table_factor` becomes a wrapper around the inner, such that after 
parsing a lone `TableFactor` here
   ```rust
       let table_factor = self.parse_table_factor_inner()?;
   ```
   it next peeks if this table factor is actually a nested join, similar to the 
current PR impl, and if it is, completes the parsing as a nested table factor
   ```rust
       let mut table_factor = self.parse_table_factor_inner()?;
   
       if self.peek_parens_less_nested_join() {
           let joins = self.parse_joins()?;
           table_factor = TableFactor::NestedJoin {
               table_with_joins: Box::new(TableWithJoins { relation: 
table_factor, joins }),
               alias: None,
           };
       }
       
       Ok(table_factor)
   ```
   
   would this be reasonable?



-- 
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