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/10/20 18:56:06 UTC

(datafusion-sqlparser-rs) branch gh-readonly-queue/main/pr-2672-f937b73ef2f27b856cbc15274e7b056a38a88385 created (now 122882891)

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

github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-2672-f937b73ef2f27b856cbc15274e7b056a38a88385
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


      at 122882891 PostgreSQL, SQLite, DuckDB, MySQL: Accept keyword-like base window names in `OVER` (#2672)

This branch includes the following new commits:

     new 122882891 PostgreSQL, SQLite, DuckDB, MySQL: Accept keyword-like base window names in `OVER` (#2672)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


(datafusion-sqlparser-rs) 01/01: PostgreSQL, SQLite, DuckDB, MySQL: Accept keyword-like base window names in `OVER` (#2672)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-2672-f937b73ef2f27b856cbc15274e7b056a38a88385
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git

commit 122882891f016ae025a6cf96038eb1eda5f14754
Author: Luca Cappelletti <ca...@gmail.com>
AuthorDate: Tue Oct 20 18:55:41 2026 +0000

    PostgreSQL, SQLite, DuckDB, MySQL: Accept keyword-like base window names in `OVER` (#2672)
---
 src/parser/mod.rs         | 11 ++++++++++-
 tests/sqlparser_common.rs | 21 +++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index a5a45bf83..5ca9152df 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -20872,7 +20872,16 @@ impl<'a> Parser<'a> {
     /// Parse a window specification.
     pub fn parse_window_spec(&mut self) -> Result<WindowSpec, ParserError> {
         let window_name = match &self.peek_token_ref().token {
-            Token::Word(word) if word.keyword == Keyword::NoKeyword => {
+            Token::Word(w)
+                if !matches!(
+                    w.keyword,
+                    Keyword::PARTITION
+                        | Keyword::ORDER
+                        | Keyword::ROWS
+                        | Keyword::RANGE
+                        | Keyword::GROUPS
+                ) =>
+            {
                 self.parse_optional_ident()?
             }
             _ => None,
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index e110fe8f1..5a5c2b317 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -20835,3 +20835,24 @@ fn display_nested_unary_minus_in_linear_time() {
         .expect("display should not take exponential time");
     assert_eq!(printed, sql);
 }
+
+#[test]
+fn parse_window_spec_keyword_base_window_name() {
+    let dialects = all_dialects();
+    for name in ["w", "id", "part"] {
+        let sql = format!("SELECT count(*) OVER ({name} ORDER BY a) FROM t");
+        let select = dialects.verified_only_select(&sql);
+        match expr_from_projection(&select.projection[0]) {
+            Expr::Function(Function {
+                over: Some(WindowType::WindowSpec(spec)),
+                ..
+            }) => assert_eq!(spec.window_name, Some(Ident::new(name)), "{sql}"),
+            other => panic!("{sql}: unexpected {other:?}"),
+        }
+    }
+    dialects.verified_stmt("SELECT count(*) OVER (ORDER BY a) FROM t");
+    dialects.verified_stmt("SELECT count(*) OVER (PARTITION BY a) FROM t");
+    dialects.verified_stmt(
+        "SELECT count(*) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t",
+    );
+}


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