forked from feldera/feldera
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_interval_arg_max.py
More file actions
161 lines (137 loc) · 7.03 KB
/
Copy pathtest_interval_arg_max.py
File metadata and controls
161 lines (137 loc) · 7.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from .aggtst_base import TstView
class aggtst_interval_arg_max(TstView):
def __init__(self):
# Result validation is not required for local views
self.data = []
self.sql = """CREATE LOCAL VIEW interval_arg_max AS SELECT
ARG_MAX(c1_minus_c2, c2_minus_c1) AS f_c1,
ARG_MAX(c1_minus_c3, c3_minus_c1) AS f_c3,
ARG_MAX(c2_minus_c3, c3_minus_c2) AS f_c5
FROM atbl_interval_seconds"""
class aggtst_interval_arg_max_seconds(TstView):
def __init__(self):
# checked manually
self.data = [{"m_c1": -1466619540, "m_c3": -571691580, "m_c5": -1681851120}]
self.sql = """CREATE MATERIALIZED VIEW interval_arg_max_seconds AS SELECT
TIMESTAMPDIFF(SECOND, d(), d() + f_c1) AS m_c1,
TIMESTAMPDIFF(SECOND, d(), d() + f_c3) AS m_c3,
TIMESTAMPDIFF(SECOND, d(), d() + f_c5) AS m_c5
FROM interval_arg_max"""
class aggtst_interval_arg_max_gby(TstView):
def __init__(self):
# Result validation is not required for local views
self.data = []
self.sql = """CREATE LOCAL VIEW interval_arg_max_gby AS SELECT
id,
ARG_MAX(c1_minus_c2, c2_minus_c1) AS f_c1,
ARG_MAX(c1_minus_c3, c3_minus_c1) AS f_c3,
ARG_MAX(c2_minus_c3, c3_minus_c2) AS f_c5
FROM atbl_interval_seconds
GROUP BY id"""
class aggtst_interval_arg_max_gby_seconds(TstView):
def __init__(self):
# checked manually
self.data = [
{
"id": 0,
"m_c1": -318226680,
"m_c3": -169024440,
"m_c5": -1681851120,
},
{"id": 1, "m_c1": -1466619540, "m_c3": -571691580, "m_c5": -1635868800},
]
self.sql = """CREATE MATERIALIZED VIEW interval_arg_max_gby_seconds AS SELECT
id,
TIMESTAMPDIFF(SECOND, d(), d() + f_c1) AS m_c1,
TIMESTAMPDIFF(SECOND, d(), d() + f_c3) AS m_c3,
TIMESTAMPDIFF(SECOND, d(), d() + f_c5) AS m_c5
FROM interval_arg_max_gby"""
class aggtst_interval_arg_max_distinct(TstView):
def __init__(self):
# Result validation is not required for local views
self.data = []
self.sql = """CREATE LOCAL VIEW interval_arg_max_distinct AS SELECT
ARG_MAX(DISTINCT c1_minus_c2, c2_minus_c1) AS f_c1,
ARG_MAX(DISTINCT c1_minus_c3, c3_minus_c1) AS f_c3,
ARG_MAX(DISTINCT c2_minus_c3, c3_minus_c2) AS f_c5
FROM atbl_interval_seconds"""
class aggtst_interval_arg_max_distinct_seconds(TstView):
def __init__(self):
# checked manually
self.data = [{"m_c1": -1466619540, "m_c3": -571691580, "m_c5": -1681851120}]
self.sql = """CREATE MATERIALIZED VIEW interval_arg_max_distinct_seconds AS SELECT
TIMESTAMPDIFF(SECOND, d(), d() + f_c1) AS m_c1,
TIMESTAMPDIFF(SECOND, d(), d() + f_c3) AS m_c3,
TIMESTAMPDIFF(SECOND, d(), d() + f_c5) AS m_c5
FROM interval_arg_max_distinct"""
class aggtst_interval_arg_max_distinct_gby(TstView):
def __init__(self):
# Result validation is not required for local views
self.data = []
self.sql = """CREATE LOCAL VIEW interval_arg_max_distinct_gby AS SELECT
id,
ARG_MAX(DISTINCT c1_minus_c2, c2_minus_c1) AS f_c1,
ARG_MAX(DISTINCT c1_minus_c3, c3_minus_c1) AS f_c3,
ARG_MAX(DISTINCT c2_minus_c3, c3_minus_c2) AS f_c5
FROM atbl_interval_seconds
GROUP BY id"""
class aggtst_interval_arg_max_distinct_gby_seconds(TstView):
def __init__(self):
# checked manually
self.data = [
{
"id": 0,
"m_c1": -318226680,
"m_c3": -169024440,
"m_c5": -1681851120,
},
{"id": 1, "m_c1": -1466619540, "m_c3": -571691580, "m_c5": -1635868800},
]
self.sql = """CREATE MATERIALIZED VIEW interval_arg_max_distinct_gby_seconds AS SELECT
id,
TIMESTAMPDIFF(SECOND, d(), d() + f_c1) AS m_c1,
TIMESTAMPDIFF(SECOND, d(), d() + f_c3) AS m_c3,
TIMESTAMPDIFF(SECOND, d(), d() + f_c5) AS m_c5
FROM interval_arg_max_distinct_gby"""
class aggtst_interval_arg_max_where(TstView):
def __init__(self):
# Result validation is not required for local views
self.data = []
self.sql = """CREATE LOCAL VIEW interval_arg_max_where AS SELECT
ARG_MAX(c1_minus_c2, c2_minus_c1) FILTER(WHERE c1_minus_c2 > c2_minus_c1) AS f_c1,
ARG_MAX(c1_minus_c3, c3_minus_c1) FILTER(WHERE c1_minus_c3 > c3_minus_c1) AS f_c3,
ARG_MAX(c2_minus_c3, c3_minus_c2) FILTER(WHERE c2_minus_c3 > c3_minus_c2) AS f_c5
FROM atbl_interval_seconds"""
class aggtst_interval_arg_max_where_seconds(TstView):
def __init__(self):
# checked manually
self.data = [{"m_c1": 318185100, "m_c3": 229712400, "m_c5": 149202240}]
self.sql = """CREATE MATERIALIZED VIEW interval_arg_max_where_seconds AS SELECT
TIMESTAMPDIFF(SECOND, d(), d() + f_c1) AS m_c1,
TIMESTAMPDIFF(SECOND, d(), d() + f_c3) AS m_c3,
TIMESTAMPDIFF(SECOND, d(), d() + f_c5) AS m_c5
FROM interval_arg_max_where"""
class aggtst_interval_arg_max_where_gby(TstView):
def __init__(self):
# Result validation is not required for local views
self.data = []
self.sql = """CREATE LOCAL VIEW interval_arg_max_where_gby AS SELECT
id,
ARG_MAX(c1_minus_c2, c2_minus_c1) FILTER(WHERE c1_minus_c2 > c2_minus_c1) AS f_c1,
ARG_MAX(c1_minus_c3, c3_minus_c1) FILTER(WHERE c1_minus_c3 > c3_minus_c1) AS f_c3,
ARG_MAX(c2_minus_c3, c3_minus_c2) FILTER(WHERE c2_minus_c3 > c3_minus_c2) AS f_c5
FROM atbl_interval_seconds
GROUP BY id"""
class aggtst_interval_arg_max_where_gby_seconds(TstView):
def __init__(self):
# checked manually
self.data = [
{"id": 0, "m_c1": 1592695620, "m_c3": None, "m_c5": 149202240},
{"id": 1, "m_c1": 318185100, "m_c3": 229712400, "m_c5": 894927960},
]
self.sql = """CREATE MATERIALIZED VIEW interval_arg_max_where_gby_seconds AS SELECT
id,
TIMESTAMPDIFF(SECOND, d(), d() + f_c1) AS m_c1,
TIMESTAMPDIFF(SECOND, d(), d() + f_c3) AS m_c3,
TIMESTAMPDIFF(SECOND, d(), d() + f_c5) AS m_c5
FROM interval_arg_max_where_gby"""