Skip to content

Commit 2fb6ce4

Browse files
committed
window function test
1 parent ad6ee9d commit 2fb6ce4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_parser/test_base_sql/test_select_structure.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,3 +1186,23 @@ def test_table_double_quote(self):
11861186

11871187
ast = parse_sql(sql)
11881188
assert str(ast) == str(expected_ast)
1189+
1190+
def test_window_function_mindsdb(self):
1191+
1192+
# modifier
1193+
query = "select SUM(col0) OVER (partition by col1 order by col2 rows between unbounded preceding and current row) from table1 "
1194+
expected_ast = Select(
1195+
targets=[
1196+
WindowFunction(
1197+
function=Function(op='sum', args=[Identifier('col0')]),
1198+
partition=[Identifier('col1')],
1199+
order_by=[OrderBy(field=Identifier('col2'))],
1200+
modifier='rows BETWEEN unbounded preceding AND current row'
1201+
)
1202+
],
1203+
from_table=Identifier('table1')
1204+
)
1205+
ast = parse_sql(query)
1206+
assert str(ast) == str(expected_ast)
1207+
assert ast.to_tree() == expected_ast.to_tree()
1208+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy