iffyio commented on code in PR #1931: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1931#discussion_r2198043261
########## src/ast/helpers/stmt_create_table.rs: ########## @@ -383,6 +383,16 @@ impl CreateTableBuilder { self } + /// Returns true if information on the structure of the table + /// to be created was provided to the builder. If not, the + /// statement is invalid. + pub fn has_schema_info(&self) -> bool { + !self.columns.is_empty() + || self.query.is_some() + || self.like.is_some() + || self.clone.is_some() Review Comment: could we add tests covering this behavior? e.g a test that fails when only a query, columns, like etc is provided in a create statement ########## tests/sqlparser_snowflake.rs: ########## @@ -995,6 +995,21 @@ fn test_snowflake_create_iceberg_table_without_location() { ); } +#[test] +fn test_snowflake_create_table_trailing_options() { + snowflake() + .parse_sql_statements( + "CREATE TEMP TABLE dst AS (SELECT * FROM src) ON COMMIT PRESERVE ROWS", + ) + .unwrap(); + snowflake() + .parse_sql_statements("CREATE TEMP TABLE tbl LIKE customers ON COMMIT PRESERVE ROWS;") + .unwrap(); + snowflake() + .parse_sql_statements("CREATE TEMP TABLE tbl CLONE customers ON COMMIT PRESERVE ROWS;") + .unwrap(); Review Comment: can we use verified_stmt here or similar roundtrip assertion? ########## src/ast/helpers/stmt_create_table.rs: ########## @@ -383,6 +383,16 @@ impl CreateTableBuilder { self } + /// Returns true if information on the structure of the table + /// to be created was provided to the builder. If not, the + /// statement is invalid. + pub fn has_schema_info(&self) -> bool { Review Comment: ```suggestion pub(crate) fn has_schema_info(&self) -> bool { ``` -- 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