You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/03/13 09:18:58 UTC

(datafusion-sqlparser-rs) 01/01: Fixed stage name parsing for snowflake (#2265)

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch gh-readonly-queue/main/pr-2265-738f12dd4d68836cd1746fb24df1db40de58bfd2
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git

commit 9d5a171a85b06ca7df083287027d8620007f909b
Author: Andriy Romanov <ar...@montecarlodata.com>
AuthorDate: Fri Mar 13 02:18:48 2026 -0700

    Fixed stage name parsing for snowflake (#2265)
---
 src/dialect/snowflake.rs     |  2 ++
 tests/sqlparser_snowflake.rs | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/src/dialect/snowflake.rs b/src/dialect/snowflake.rs
index 6c160a9d..f0f33f8e 100644
--- a/src/dialect/snowflake.rs
+++ b/src/dialect/snowflake.rs
@@ -1258,6 +1258,8 @@ pub fn parse_stage_name_identifier(parser: &mut Parser) -> Result<Ident, ParserE
             Token::Div => ident.push('/'),
             Token::Plus => ident.push('+'),
             Token::Minus => ident.push('-'),
+            Token::Eq => ident.push('='),
+            Token::Colon => ident.push(':'),
             Token::Number(n, _) => ident.push_str(n),
             Token::Word(w) => ident.push_str(&w.to_string()),
             _ => return parser.expected_ref("stage name identifier", parser.peek_token_ref()),
diff --git a/tests/sqlparser_snowflake.rs b/tests/sqlparser_snowflake.rs
index 265f8a9a..0da44aa7 100644
--- a/tests/sqlparser_snowflake.rs
+++ b/tests/sqlparser_snowflake.rs
@@ -2640,6 +2640,21 @@ fn test_snowflake_copy_into_stage_name_ends_with_parens() {
     }
 }
 
+#[test]
+fn test_snowflake_stage_name_with_special_chars() {
+    // Stage path with '=' (Hive-style partitioning)
+    snowflake().verified_stmt("SELECT * FROM @stage/day=18/23.parquet");
+
+    // Stage path with ':' (time-based partitioning)
+    snowflake().verified_stmt("SELECT * FROM @stage/0:18:23/23.parquet");
+
+    // COPY INTO with '=' in stage path
+    snowflake().verified_stmt("COPY INTO my_table FROM @stage/day=18/file.parquet");
+
+    // COPY INTO with ':' in stage path
+    snowflake().verified_stmt("COPY INTO my_table FROM @stage/0:18:23/file.parquet");
+}
+
 #[test]
 fn test_snowflake_trim() {
     let real_sql = r#"SELECT customer_id, TRIM(sub_items.value:item_price_id, '"', "a") AS item_price_id FROM models_staging.subscriptions"#;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org