iffyio commented on code in PR #1976: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1976#discussion_r2231396257
########## tests/sqlparser_bigquery.rs: ########## @@ -2566,3 +2566,24 @@ fn test_struct_trailing_and_nested_bracket() { ) ); } + +#[test] +fn test_export() { Review Comment: Since this introduces a new statement, can we include an assertion on the AST for one of the statements, checking that the returned AST looks like what we expect? [For example](https://github.com/apache/datafusion-sqlparser-rs/blob/1a7e8d969ae509d99f5f9aa1136092da002a77c6/tests/sqlparser_bigquery.rs#L2203-L2232) Also could we add coverage for some scenarios like the following? ``` "EXPORT DATA OPTIONS()"; "EXPORT DATA AS SELECT ..."; "EXPORT DATA WITH CONNECTION ... AS SELECT ..." ``` ########## src/parser/mod.rs: ########## @@ -645,6 +645,7 @@ impl<'a> Parser<'a> { Keyword::COMMENT if self.dialect.supports_comment_on() => self.parse_comment(), Keyword::PRINT => self.parse_print(), Keyword::RETURN => self.parse_return(), + Keyword::EXPORT => self.parse_export(), Review Comment: Could we do [similar to here](https://github.com/apache/datafusion-sqlparser-rs/blob/1a7e8d969ae509d99f5f9aa1136092da002a77c6/src/parser/mod.rs#L607) where we call `prev_token()` so that the `parse-export()` function is stand alone and able to parse a complete statement? ########## src/parser/mod.rs: ########## @@ -16510,6 +16511,27 @@ impl<'a> Parser<'a> { } } + fn parse_export(&mut self) -> Result<Statement, ParserError> { Review Comment: ```suggestion fn parse_export_date(&mut self) -> Result<Statement, ParserError> { ``` Could we also add a short description mentioning that this parses a `Statement::ExportData` statement? [For example](https://github.com/apache/datafusion-sqlparser-rs/blob/1a7e8d969ae509d99f5f9aa1136092da002a77c6/src/parser/mod.rs#L659-L661) ########## src/ast/mod.rs: ########## @@ -4355,6 +4355,14 @@ pub enum Statement { /// /// See [ReturnStatement] Return(ReturnStatement), + /// Export data statement + /// + /// Example: + /// ```sql + /// EXPORT DATA OPTIONS(uri='gs://bucket/folder/*', format='PARQUET', overwrite=true) AS + /// SELECT field1, field2 FROM mydataset.table1 ORDER BY field1 LIMIT 10 + /// ``` + ExportData(ExportData), Review Comment: Could we add a link to the bigquery docs where the syntax comes from? -- 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