-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for duckdb style "FROM <tbl>" statements #1144
feat: add support for duckdb style "FROM <tbl>" statements #1144
Conversation
@@ -6722,6 +6726,8 @@ impl<'a> Parser<'a> { | |||
SetExpr::Values(self.parse_values(is_mysql)?) | |||
} else if self.parse_keyword(Keyword::TABLE) { | |||
SetExpr::Table(Box::new(self.parse_as_table()?)) | |||
} else if self.parse_keyword(Keyword::FROM) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why, but adding this branch causes SO in the recursion tests such as parse_deeply_nested_parens_hits_recursion_limits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if the branch is never met, the presence of it is causing SO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe @alamb, @andygrove @nickolay knows why adding this condition causes a SO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch probably makes the stack frame size increase in debug builds as it adds some new local variables. I think we could fix the test by decreasing the recursion limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution @universalmind303 -- I left some comments that hopefully will help us get this PR good to go
@@ -6722,6 +6726,8 @@ impl<'a> Parser<'a> { | |||
SetExpr::Values(self.parse_values(is_mysql)?) | |||
} else if self.parse_keyword(Keyword::TABLE) { | |||
SetExpr::Table(Box::new(self.parse_as_table()?)) | |||
} else if self.parse_keyword(Keyword::FROM) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch probably makes the stack frame size increase in debug builds as it adds some new local variables. I think we could fix the test by decreasing the recursion limit
#[test] | ||
fn test_duckdb_from_statement_with_filter_and_select() { | ||
let stmt = duckdb().verified_only_select("FROM t1 SELECT b WHERE a = 1"); | ||
println!("{:?}", stmt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left over?
#[test] | ||
fn test_duckdb_from_statement_with_filter() { | ||
let stmt = duckdb().verified_only_select("FROM t1 WHERE a = 1"); | ||
println!("{:?}", stmt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left over?
|
||
/// Parse a duckdb style `FROM` statement without a select. | ||
/// assuming the initial `FROM` was already consumed | ||
pub fn parse_from_select(&mut self) -> Result<Select, ParserError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems largely copied from the normal select parsing -- is there any way to refactor the code to reduce the duplication
Marking as Draft to signify this PR is no longer waiting on review. Please mark it as ready for review when it is ready for another look. |
FWIW @Nikita-str has solved the stack overflow issues in #1171 if you wanted to revive this PR. |
allows for parsing of duckdb's
from
queriescloses #1143