-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathtest_agg.py
More file actions
194 lines (156 loc) · 6.85 KB
/
test_agg.py
File metadata and controls
194 lines (156 loc) · 6.85 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
from tests.runtime_aggtest.aggtst_base import TstView
# ARRAY_AGG
class illarg_arr_agg_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_arr_agg_illegal AS SELECT
ARRAY_AGG(intt, intt) AS arr
FROM illegal_tbl
WHERE id = 0"""
self.expected_error = "Invalid number of arguments to function 'ARRAY_AGG'. Was expecting 1 arguments"
# AVG
class illarg_avg_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_avg_illegal AS SELECT
AVG(booll) AS arr
FROM illegal_tbl
WHERE id = 0"""
self.expected_error = "Cannot apply 'AVG' to arguments of type"
# ARG_MAX
class illarg_arg_max_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_arg_max_illegal AS SELECT
ARG_MAX(udt) AS udt
FROM illegal_tbl"""
self.expected_error = "Invalid number of arguments to function 'ARG_MAX'. Was expecting 2 arguments"
# ARG_MIN
class illarg_arg_min_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_arg_min_illegal AS SELECT
ARG_MIN(roww, roww, roww) AS roww
FROM illegal_tbl"""
self.expected_error = "Invalid number of arguments to function 'ARG_MIN'. Was expecting 2 arguments"
# BIT_AND
class illarg_bit_and_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_bit_and_illegal AS SELECT
BIT_AND(roww) AS roww
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'BIT_AND' to arguments of type "
# BIT_OR
class illarg_bit_or_illegal(TstView):
def __init__(self):
self.sql = """CREATE MATERIALIZED VIEW illarg_bit_or_illegal AS SELECT
BIT_OR(udt) AS udt
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'BIT_OR' to arguments of type "
# BIT_XOR
class illarg_bit_xor_illegal(TstView):
def __init__(self):
self.sql = """CREATE MATERIALIZED VIEW illarg_bit_xor_illegal AS SELECT
BIT_XOR(udt) AS udt
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'BIT_XOR' to arguments of type "
# COUNT
class illarg_count_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_count_illegal AS SELECT
COUNT(udt, COUNT(intt)) AS udt
FROM illegal_tbl"""
self.expected_error = "Aggregate expressions cannot be nested"
# COUNTIF
class illarg_countif_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_countif_illegal AS SELECT
COUNTIF(reall < 0.2, decimall > 2) AS reall
FROM illegal_tbl"""
self.expected_error = "invalid number of arguments to function 'countif'"
# EVERY
class illarg_every_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_every_illegal AS SELECT
EVERY(intt) AS intt
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'EVERY' to arguments of type 'EVERY(<INTEGER>)'. Supported form(s): 'EVERY(<BOOLEAN>)'"
# SOME
class illarg_some_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_some_illegal AS SELECT
SOME(intt) AS intt
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'SOME' to arguments of type 'SOME(<INTEGER>)'. Supported form(s): 'SOME(<BOOLEAN>)'"
# BOOL_AND
class illarg_bool_and_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_bool_and_illegal AS SELECT
BOOL_AND(udt[2] IS NOT NULL, arr[2] IS NOT NULL) AS udt
FROM illegal_tbl"""
self.expected_error = "Invalid number of arguments to function 'BOOL_AND'. Was expecting 1 arguments"
# BOOL_OR
class illarg_bool_or_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_bool_or_illegal AS SELECT
BOOL_OR(arr[2] IS NOT NULL, arr[2] IS NOT NULL) AS arr
FROM illegal_tbl"""
self.expected_error = "Invalid number of arguments to function 'BOOL_OR'. Was expecting 1 arguments"
# MAX
class illarg_max_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_max_illegal AS SELECT
MAX(udt[2], arr[2]) AS udt
FROM illegal_tbl"""
self.expected_error = (
"Invalid number of arguments to function 'MAX'. Was expecting 1 arguments"
)
# MIN
class illarg_min_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_min_illegal AS SELECT
MIN(udt[2], arr[2]) AS udt
FROM illegal_tbl"""
self.expected_error = (
"Invalid number of arguments to function 'MIN'. Was expecting 1 arguments"
)
# SUM
class illarg_sum_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_sum_illegal AS SELECT
SUM(udt) AS udt
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'SUM' to arguments of type "
class illarg_sum_illegal1(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_sum_illegal1 AS SELECT
SUM(str) AS str
FROM illegal_tbl"""
self.expected_error = "Cannot parse hello into a DECIMAL(38, 19)"
# STDDEV
class illarg_stddev_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_stddev_illegal AS SELECT
STDDEV(roww) AS roww
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'STDDEV' to arguments of type "
# STDDEV_POP
class illarg_stddev_pop_illegal(TstView):
def __init__(self):
# checked manually
self.sql = """CREATE MATERIALIZED VIEW illarg_stddev_pop_illegal AS SELECT
STDDEV_POP(roww) AS roww
FROM illegal_tbl"""
self.expected_error = "Cannot apply 'STDDEV_POP' to arguments of type "