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 c3256a80 Do not parse ASOF and MATCH_CONDITION as table factor aliases 
(#1698)
c3256a80 is described below

commit c3256a80d7b9708c6abf025f24a72779277f3a34
Author: Yoav Cohen <[email protected]>
AuthorDate: Sat Feb 1 13:42:38 2025 +0100

    Do not parse ASOF and MATCH_CONDITION as table factor aliases (#1698)
---
 src/keywords.rs              |  2 ++
 tests/sqlparser_snowflake.rs | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/keywords.rs b/src/keywords.rs
index 02ce0498..5937d775 100644
--- a/src/keywords.rs
+++ b/src/keywords.rs
@@ -1000,6 +1000,8 @@ pub const RESERVED_FOR_TABLE_ALIAS: &[Keyword] = &[
     Keyword::ANTI,
     Keyword::SEMI,
     Keyword::RETURNING,
+    Keyword::ASOF,
+    Keyword::MATCH_CONDITION,
     // for MSSQL-specific OUTER APPLY (seems reserved in most dialects)
     Keyword::OUTER,
     Keyword::SET,
diff --git a/tests/sqlparser_snowflake.rs b/tests/sqlparser_snowflake.rs
index 1310b984..1036ce1f 100644
--- a/tests/sqlparser_snowflake.rs
+++ b/tests/sqlparser_snowflake.rs
@@ -2731,6 +2731,20 @@ fn asof_joins() {
               "ON s.state = p.state ",
           "ORDER BY s.observed",
     ));
+
+    // Test without explicit aliases
+    #[rustfmt::skip]
+    snowflake_and_generic().verified_query(concat!(
+        "SELECT * ",
+          "FROM snowtime ",
+            "ASOF JOIN raintime ",
+              "MATCH_CONDITION (snowtime.observed >= raintime.observed) ",
+              "ON snowtime.state = raintime.state ",
+            "ASOF JOIN preciptime ",
+              "MATCH_CONDITION (showtime.observed >= preciptime.observed) ",
+              "ON showtime.state = preciptime.state ",
+          "ORDER BY showtime.observed",
+    ));
 }
 
 #[test]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to