summaryrefslogtreecommitdiffstats
path: root/tests/test_build.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-04 07:24:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-04 07:24:05 +0000
commit621555af37594a213d91ea113d5fc7739af84d40 (patch)
tree5aaa3b586692062accffc21cfaaa5a3917ee77b3 /tests/test_build.py
parentAdding upstream version 10.2.9. (diff)
downloadsqlglot-621555af37594a213d91ea113d5fc7739af84d40.tar.xz
sqlglot-621555af37594a213d91ea113d5fc7739af84d40.zip
Adding upstream version 10.4.2.upstream/10.4.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_build.py')
-rw-r--r--tests/test_build.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index b014a3a..a1a268d 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -481,6 +481,19 @@ class TestBuild(unittest.TestCase):
),
(lambda: exp.delete("y", where="x > 1"), "DELETE FROM y WHERE x > 1"),
(lambda: exp.delete("y", where=exp.and_("x > 1")), "DELETE FROM y WHERE x > 1"),
+ (
+ lambda: select("AVG(a) OVER b")
+ .from_("table")
+ .window("b AS (PARTITION BY c ORDER BY d)"),
+ "SELECT AVG(a) OVER b FROM table WINDOW b AS (PARTITION BY c ORDER BY d)",
+ ),
+ (
+ lambda: select("AVG(a) OVER b", "MIN(c) OVER d")
+ .from_("table")
+ .window("b AS (PARTITION BY e ORDER BY f)")
+ .window("d AS (PARTITION BY g ORDER BY h)"),
+ "SELECT AVG(a) OVER b, MIN(c) OVER d FROM table WINDOW b AS (PARTITION BY e ORDER BY f), d AS (PARTITION BY g ORDER BY h)",
+ ),
]:
with self.subTest(sql):
self.assertEqual(expression().sql(dialect[0] if dialect else None), sql)