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 actual impl
`parse_table_factor`, 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: [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]