iffyio commented on code in PR #1999: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1999#discussion_r2262448798
########## tests/sqlparser_common.rs: ########## @@ -4758,6 +4758,25 @@ fn parse_alter_table() { } } +#[test] +fn alter_table_span_includes_semicolon() { + use sqlparser::ast::Spanned; + use sqlparser::dialect::PostgreSqlDialect; + use sqlparser::parser::Parser; + + let sql = r#"-- foo +ALTER TABLE users + ADD COLUMN foo + varchar; -- hi there"#; + let dialect = PostgreSqlDialect {}; + let ast = Parser::parse_sql(&dialect, sql).unwrap(); + let stmt = &ast[0]; + let span = stmt.span(); + + assert_eq!(span.end.line, 4); + assert_eq!(span.end.column, 11); +} + Review Comment: this seems like a similar test to the one in spans.rs, the latter felt like it should provide sufficient coverage so that we can likely skip this one? ########## src/ast/mod.rs: ########## @@ -3382,6 +3382,9 @@ pub enum Statement { /// Snowflake "ICEBERG" clause for Iceberg tables /// <https://docs.snowflake.com/en/sql-reference/sql/alter-iceberg-table> iceberg: bool, + /// Token that represents the end of the statement (semicolon or EOF) + /// Used for accurate span calculation Review Comment: ```suggestion ``` -- 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