This is an automated email from the ASF dual-hosted git repository. iffyio pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
The following commit(s) were added to refs/heads/main by this push: new 18b4a14e Snowflake - support table function in table factor (regression) (#1996) 18b4a14e is described below commit 18b4a14e0f14fad05d6df9adcaeaecc996f54b28 Author: tomershaniii <65544633+tomershan...@users.noreply.github.com> AuthorDate: Fri Aug 8 12:22:30 2025 +0300 Snowflake - support table function in table factor (regression) (#1996) --- src/dialect/snowflake.rs | 2 ++ tests/sqlparser_snowflake.rs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dialect/snowflake.rs b/src/dialect/snowflake.rs index 697ba3b4..8830e09a 100644 --- a/src/dialect/snowflake.rs +++ b/src/dialect/snowflake.rs @@ -515,6 +515,8 @@ impl Dialect for SnowflakeDialect { fn is_table_factor(&self, kw: &Keyword, parser: &mut Parser) -> bool { match kw { Keyword::LIMIT if peek_for_limit_options(parser) => false, + // Table function + Keyword::TABLE if matches!(parser.peek_token_ref().token, Token::LParen) => true, _ => !RESERVED_KEYWORDS_FOR_TABLE_FACTOR.contains(kw), } } diff --git a/tests/sqlparser_snowflake.rs b/tests/sqlparser_snowflake.rs index eb4bda7b..bd8a6d30 100644 --- a/tests/sqlparser_snowflake.rs +++ b/tests/sqlparser_snowflake.rs @@ -3609,9 +3609,13 @@ fn test_sql_keywords_as_table_aliases() { #[test] fn test_sql_keywords_as_table_factor() { // LIMIT is a table factor, Snowflake does not reserve it - snowflake().one_statement_parses_to("SELECT * FROM tbl, LIMIT", "SELECT * FROM tbl, LIMIT"); + snowflake().verified_stmt("SELECT * FROM tbl, LIMIT"); // LIMIT is not a table factor snowflake().one_statement_parses_to("SELECT * FROM tbl, LIMIT 1", "SELECT * FROM tbl LIMIT 1"); + + // Table functions are table factors + snowflake().verified_stmt("SELECT 1 FROM TABLE(GENERATOR(ROWCOUNT => 10)) AS a, TABLE(GENERATOR(ROWCOUNT => 10)) AS b"); + // ORDER is reserved assert!(snowflake() .parse_sql_statements("SELECT * FROM tbl, order") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@datafusion.apache.org For additional commands, e-mail: commits-h...@datafusion.apache.org