-
Notifications
You must be signed in to change notification settings - Fork 0
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
BigQuery partition by in create table. #31
BigQuery partition by in create table. #31
Conversation
@@ -4083,6 +4083,13 @@ impl<'a> Parser<'a> { | |||
None | |||
}; | |||
|
|||
// In BigQuery PARITION BY can be also defined after columns | |||
let partitioned_by = if self.parse_keywords(&[Keyword::PARTITION, Keyword::BY]) { | |||
Some(self.parse_expr()?) |
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.
Went through code base and parsing PARTITION BY
or PARTITION
in parts like window specification are always parsing just expr. Keeping the same parsing.
Also not guarding it by dialect as whole parse_create_table
is dialect independent.
tests/sqlparser_common.rs
Outdated
let res = Parser::new(&dialect) | ||
.try_with_sql(&sql) | ||
.expect("tokenize to work") | ||
.with_recursion_limit(38) |
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.
The stack frame size increased in debug builds as this PR adds new local variables.
I fixed the test by decreasing recursion limit (39 is still raising an stack overflow error). @lustefaniak I could decrease it here as default value for logic https://github.com/getsynq/sqlparser-rs/blob/main/src/parser/mod.rs#L200, but not sure about it.
What is your advice?
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.
We need to decrease it in the default, as that is the one used by the gRPC service, if the code is going to fail otherwise we need to make sure it works and cleanly reports failure instead of crashing the app.
Why
BigQuery create table statement is supporting
PARTITION BY <expr>
after column difinition. This PR is allowing us to parse these statements.BigQuery doc