iffyio commented on code in PR #2269:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2269#discussion_r2904260730
##########
tests/sqlparser_bigquery.rs:
##########
@@ -2890,3 +2890,24 @@ fn test_alter_schema() {
bigquery_and_generic()
.verified_stmt("ALTER SCHEMA IF EXISTS mydataset SET OPTIONS (location
= 'us')");
}
+
+#[test]
+fn test_create_snapshot_table() {
+ bigquery().verified_stmt("CREATE SNAPSHOT TABLE dataset_id.table1 CLONE
dataset_id.table2");
Review Comment:
```suggestion
bigquery_and_generic().verified_stmt("CREATE SNAPSHOT TABLE
dataset_id.table1 CLONE dataset_id.table2");
```
can the tests cover generic as well?
##########
src/parser/mod.rs:
##########
@@ -5099,7 +5099,9 @@ impl<'a> Parser<'a> {
let persistent = dialect_of!(self is DuckDbDialect)
&& self.parse_one_of_keywords(&[Keyword::PERSISTENT]).is_some();
let create_view_params = self.parse_create_view_params()?;
- if self.parse_keyword(Keyword::TABLE) {
+ if self.parse_keywords(&[Keyword::SNAPSHOT, Keyword::TABLE]) {
Review Comment:
```suggestion
if self.peek_keywords(&[Keyword::SNAPSHOT, Keyword::TABLE]) {
```
thinking we can peek here so that the `parse_create_snapshot_table()`
function is standalone
##########
src/ast/ddl.rs:
##########
@@ -2903,6 +2903,9 @@ pub struct CreateTable {
pub volatile: bool,
/// `ICEBERG` clause
pub iceberg: bool,
+ /// BigQuery `SNAPSHOT` clause
Review Comment:
```suggestion
/// `SNAPSHOT` clause
```
##########
src/parser/mod.rs:
##########
@@ -6314,6 +6316,39 @@ impl<'a> Parser<'a> {
.build())
}
+ /// Parse BigQuery `CREATE SNAPSHOT TABLE` statement.
Review Comment:
```suggestion
/// Parse `CREATE SNAPSHOT TABLE` statement.
```
I'm thinking in general we can avoid inlining the dialect in the description
(the doc links provide context on which dialects support the syntax). Otherwise
it becomes confusing/misleading over time documentation wise as multiple
dialects support the same or part of the syntax
##########
src/ast/helpers/stmt_create_table.rs:
##########
@@ -81,6 +81,8 @@ pub struct CreateTableBuilder {
pub volatile: bool,
/// Iceberg-specific table flag.
pub iceberg: bool,
+ /// BigQuery `SNAPSHOT` table flag.
Review Comment:
```suggestion
/// `SNAPSHOT` table flag.
```
##########
src/ast/helpers/stmt_create_table.rs:
##########
@@ -278,6 +281,11 @@ impl CreateTableBuilder {
self.iceberg = iceberg;
self
}
+ /// Set `SNAPSHOT` table flag (BigQuery).
Review Comment:
```suggestion
/// Set `SNAPSHOT` table flag.
```
--
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]