Adding test to check default window function frame.

This commit is contained in:
Vitaliy Zakaznikov 2021-06-09 15:48:22 -04:00
parent bc4b696bf9
commit a5d5f13497

View File

@ -3,6 +3,45 @@ from testflows.core import *
from window_functions.requirements import * from window_functions.requirements import *
from window_functions.tests.common import * from window_functions.tests.common import *
@TestFeature
@Requirements(
RQ_SRS_019_ClickHouse_WindowFunctions_FrameClause_DefaultFrame("1.0")
)
def default_frame(self):
"""Check default frame.
"""
with Scenario("with order by"):
expected = convert_output("""
number | sum
---------+------
1 | 2
1 | 2
2 | 4
3 | 10
3 | 10
""")
execute_query(
"select number, sum(number) OVER (ORDER BY number) AS sum FROM values('number Int8', (1),(1),(2),(3),(3))",
expected=expected
)
with Scenario("without order by"):
expected = convert_output("""
number | sum
---------+------
1 | 10
1 | 10
2 | 10
3 | 10
3 | 10
""")
execute_query(
"select number, sum(number) OVER () AS sum FROM values('number Int8', (1),(1),(2),(3),(3))",
expected=expected
)
@TestFeature @TestFeature
@Name("frame clause") @Name("frame clause")
@Requirements( @Requirements(
@ -22,6 +61,7 @@ from window_functions.tests.common import *
def feature(self): def feature(self):
"""Check defining frame clause. """Check defining frame clause.
""" """
Feature(run=default_frame, flags=TE)
Feature(run=load("window_functions.tests.rows_frame", "feature"), flags=TE) Feature(run=load("window_functions.tests.rows_frame", "feature"), flags=TE)
Feature(run=load("window_functions.tests.range_frame", "feature"), flags=TE) Feature(run=load("window_functions.tests.range_frame", "feature"), flags=TE)
Feature(run=load("window_functions.tests.range_overflow", "feature"), flags=TE) Feature(run=load("window_functions.tests.range_overflow", "feature"), flags=TE)