Skip to content

Commit cc658c9

Browse files
committed
Update the golden files
1 parent e54839b commit cc658c9

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

sql/core/src/test/resources/sql-tests/results/group-by-filter.sql.out

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,53 +51,53 @@ SELECT a, COUNT(b) FILTER (WHERE a >= 2) FROM testData
5151
struct<>
5252
-- !query 3 output
5353
org.apache.spark.sql.AnalysisException
54-
grouping expressions sequence is empty, and 'testdata.`a`' is not an aggregate function. Wrap '(count(testdata.`b`) AS `count(b)`)' in windowing function(s) or wrap 'testdata.`a`' in first() (or first_value) if you don't care which value you get.;
54+
grouping expressions sequence is empty, and 'testdata.`a`' is not an aggregate function. Wrap '(count(testdata.`b`) FILTER (testdata.`a` >= 2) AS `count(b) FILTER (a >= 2)`)' in windowing function(s) or wrap 'testdata.`a`' in first() (or first_value) if you don't care which value you get.;
5555

5656

5757
-- !query 4
5858
SELECT COUNT(a) FILTER (WHERE a = 1), COUNT(b) FILTER (WHERE a > 1) FROM testData
5959
-- !query 4 schema
60-
struct<count(a):bigint,count(b):bigint>
60+
struct<count(a) FILTER (a = 1):bigint,count(b) FILTER (a > 1):bigint>
6161
-- !query 4 output
6262
2 4
6363

6464

6565
-- !query 5
6666
SELECT COUNT(id) FILTER (WHERE hiredate = date "2001-01-01") FROM emp
6767
-- !query 5 schema
68-
struct<count(id):bigint>
68+
struct<count(id) FILTER (hiredate = DATE '2001-01-01'):bigint>
6969
-- !query 5 output
7070
2
7171

7272

7373
-- !query 6
7474
SELECT COUNT(id) FILTER (WHERE hiredate = to_date('2001-01-01 00:00:00')) FROM emp
7575
-- !query 6 schema
76-
struct<count(id):bigint>
76+
struct<count(id) FILTER (hiredate = to_date('2001-01-01 00:00:00')):bigint>
7777
-- !query 6 output
7878
2
7979

8080

8181
-- !query 7
8282
SELECT COUNT(id) FILTER (WHERE hiredate = to_timestamp("2001-01-01 00:00:00")) FROM emp
8383
-- !query 7 schema
84-
struct<count(id):bigint>
84+
struct<count(id) FILTER (CAST(hiredate AS TIMESTAMP) = to_timestamp('2001-01-01 00:00:00')):bigint>
8585
-- !query 7 output
8686
2
8787

8888

8989
-- !query 8
9090
SELECT COUNT(id) FILTER (WHERE date_format(hiredate, "yyyy-MM-dd") = "2001-01-01") FROM emp
9191
-- !query 8 schema
92-
struct<count(id):bigint>
92+
struct<count(id) FILTER (date_format(CAST(hiredate AS TIMESTAMP), yyyy-MM-dd) = 2001-01-01):bigint>
9393
-- !query 8 output
9494
2
9595

9696

9797
-- !query 9
9898
SELECT a, COUNT(b) FILTER (WHERE a >= 2) FROM testData GROUP BY a
9999
-- !query 9 schema
100-
struct<a:int,count(b):bigint>
100+
struct<a:int,count(b) FILTER (a >= 2):bigint>
101101
-- !query 9 output
102102
1 0
103103
2 2
@@ -117,7 +117,7 @@ expression 'testdata.`a`' is neither present in the group by, nor is it an aggre
117117
-- !query 11
118118
SELECT COUNT(a) FILTER (WHERE a >= 0), COUNT(b) FILTER (WHERE a >= 3) FROM testData GROUP BY a
119119
-- !query 11 schema
120-
struct<count(a):bigint,count(b):bigint>
120+
struct<count(a) FILTER (a >= 0):bigint,count(b) FILTER (a >= 3):bigint>
121121
-- !query 11 output
122122
0 0
123123
2 0
@@ -128,7 +128,7 @@ struct<count(a):bigint,count(b):bigint>
128128
-- !query 12
129129
SELECT dept_id, SUM(salary) FILTER (WHERE hiredate > date "2003-01-01") FROM emp GROUP BY dept_id
130130
-- !query 12 schema
131-
struct<dept_id:int,sum(salary):double>
131+
struct<dept_id:int,sum(salary) FILTER (hiredate > DATE '2003-01-01'):double>
132132
-- !query 12 output
133133
10 200.0
134134
100 400.0
@@ -141,7 +141,7 @@ NULL NULL
141141
-- !query 13
142142
SELECT dept_id, SUM(salary) FILTER (WHERE hiredate > to_date("2003-01-01")) FROM emp GROUP BY dept_id
143143
-- !query 13 schema
144-
struct<dept_id:int,sum(salary):double>
144+
struct<dept_id:int,sum(salary) FILTER (hiredate > to_date('2003-01-01')):double>
145145
-- !query 13 output
146146
10 200.0
147147
100 400.0
@@ -154,7 +154,7 @@ NULL NULL
154154
-- !query 14
155155
SELECT dept_id, SUM(salary) FILTER (WHERE hiredate > to_timestamp("2003-01-01 00:00:00")) FROM emp GROUP BY dept_id
156156
-- !query 14 schema
157-
struct<dept_id:int,sum(salary):double>
157+
struct<dept_id:int,sum(salary) FILTER (CAST(hiredate AS TIMESTAMP) > to_timestamp('2003-01-01 00:00:00')):double>
158158
-- !query 14 output
159159
10 200.0
160160
100 400.0
@@ -167,7 +167,7 @@ NULL NULL
167167
-- !query 15
168168
SELECT dept_id, SUM(salary) FILTER (WHERE date_format(hiredate, "yyyy-MM-dd") > "2003-01-01") FROM emp GROUP BY dept_id
169169
-- !query 15 schema
170-
struct<dept_id:int,sum(salary):double>
170+
struct<dept_id:int,sum(salary) FILTER (date_format(CAST(hiredate AS TIMESTAMP), yyyy-MM-dd) > 2003-01-01):double>
171171
-- !query 15 output
172172
10 200.0
173173
100 400.0
@@ -180,39 +180,39 @@ NULL NULL
180180
-- !query 16
181181
SELECT 'foo', COUNT(a) FILTER (WHERE b <= 2) FROM testData GROUP BY 1
182182
-- !query 16 schema
183-
struct<foo:string,count(a):bigint>
183+
struct<foo:string,count(a) FILTER (b <= 2):bigint>
184184
-- !query 16 output
185185
foo 6
186186

187187

188188
-- !query 17
189189
SELECT 'foo', SUM(salary) FILTER (WHERE hiredate >= date "2003-01-01") FROM emp GROUP BY 1
190190
-- !query 17 schema
191-
struct<foo:string,sum(salary):double>
191+
struct<foo:string,sum(salary) FILTER (hiredate >= DATE '2003-01-01'):double>
192192
-- !query 17 output
193193
foo 1350.0
194194

195195

196196
-- !query 18
197197
SELECT 'foo', SUM(salary) FILTER (WHERE hiredate >= to_date("2003-01-01")) FROM emp GROUP BY 1
198198
-- !query 18 schema
199-
struct<foo:string,sum(salary):double>
199+
struct<foo:string,sum(salary) FILTER (hiredate >= to_date('2003-01-01')):double>
200200
-- !query 18 output
201201
foo 1350.0
202202

203203

204204
-- !query 19
205205
SELECT 'foo', SUM(salary) FILTER (WHERE hiredate >= to_timestamp("2003-01-01")) FROM emp GROUP BY 1
206206
-- !query 19 schema
207-
struct<foo:string,sum(salary):double>
207+
struct<foo:string,sum(salary) FILTER (CAST(hiredate AS TIMESTAMP) >= to_timestamp('2003-01-01')):double>
208208
-- !query 19 output
209209
foo 1350.0
210210

211211

212212
-- !query 20
213213
select dept_id, count(distinct emp_name), count(distinct hiredate), sum(salary), sum(salary) filter (where id > 200) from emp group by dept_id
214214
-- !query 20 schema
215-
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary):double,sum(salary):double>
215+
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary):double,sum(salary) FILTER (id > 200):double>
216216
-- !query 20 output
217217
10 2 2 400.0 NULL
218218
100 2 2 800.0 800.0
@@ -225,7 +225,7 @@ NULL 1 1 400.0 400.0
225225
-- !query 21
226226
select dept_id, count(distinct emp_name), count(distinct hiredate), sum(salary), sum(salary) filter (where id + dept_id > 500) from emp group by dept_id
227227
-- !query 21 schema
228-
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary):double,sum(salary):double>
228+
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary):double,sum(salary) FILTER ((id + dept_id) > 500):double>
229229
-- !query 21 output
230230
10 2 2 400.0 NULL
231231
100 2 2 800.0 800.0
@@ -238,7 +238,7 @@ NULL 1 1 400.0 NULL
238238
-- !query 22
239239
select dept_id, count(distinct emp_name), count(distinct hiredate), sum(salary) filter (where salary < 400.00D), sum(salary) filter (where id > 200) from emp group by dept_id
240240
-- !query 22 schema
241-
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary):double,sum(salary):double>
241+
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary) FILTER (salary < 400.0):double,sum(salary) FILTER (id > 200):double>
242242
-- !query 22 output
243243
10 2 2 400.0 NULL
244244
100 2 2 NULL 800.0
@@ -251,7 +251,7 @@ NULL 1 1 NULL 400.0
251251
-- !query 23
252252
select dept_id, count(distinct emp_name), count(distinct hiredate), sum(salary) filter (where salary < 400.00D), sum(salary) filter (where id + dept_id > 500) from emp group by dept_id
253253
-- !query 23 schema
254-
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary):double,sum(salary):double>
254+
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary) FILTER (salary < 400.0):double,sum(salary) FILTER ((id + dept_id) > 500):double>
255255
-- !query 23 output
256256
10 2 2 400.0 NULL
257257
100 2 2 NULL 800.0
@@ -264,23 +264,23 @@ NULL 1 1 NULL NULL
264264
-- !query 24
265265
SELECT 'foo', APPROX_COUNT_DISTINCT(a) FILTER (WHERE b >= 0) FROM testData WHERE a = 0 GROUP BY 1
266266
-- !query 24 schema
267-
struct<foo:string,approx_count_distinct(a):bigint>
267+
struct<foo:string,approx_count_distinct(a) FILTER (b >= 0):bigint>
268268
-- !query 24 output
269269

270270

271271

272272
-- !query 25
273273
SELECT 'foo', MAX(STRUCT(a)) FILTER (WHERE b >= 1) FROM testData WHERE a = 0 GROUP BY 1
274274
-- !query 25 schema
275-
struct<foo:string,max(named_struct(a, a)):struct<a:int>>
275+
struct<foo:string,max(named_struct(a, a)) FILTER (b >= 1):struct<a:int>>
276276
-- !query 25 output
277277

278278

279279

280280
-- !query 26
281281
SELECT a + b, COUNT(b) FILTER (WHERE b >= 2) FROM testData GROUP BY a + b
282282
-- !query 26 schema
283-
struct<(a + b):int,count(b):bigint>
283+
struct<(a + b):int,count(b) FILTER (b >= 2):bigint>
284284
-- !query 26 output
285285
2 0
286286
3 1
@@ -301,7 +301,7 @@ expression 'testdata.`a`' is neither present in the group by, nor is it an aggre
301301
-- !query 28
302302
SELECT a + 1 + 1, COUNT(b) FILTER (WHERE b > 0) FROM testData GROUP BY a + 1
303303
-- !query 28 schema
304-
struct<((a + 1) + 1):int,count(b):bigint>
304+
struct<((a + 1) + 1):int,count(b) FILTER (b > 0):bigint>
305305
-- !query 28 output
306306
3 2
307307
4 2
@@ -312,7 +312,7 @@ NULL 1
312312
-- !query 29
313313
SELECT a AS k, COUNT(b) FILTER (WHERE b > 0) FROM testData GROUP BY k
314314
-- !query 29 schema
315-
struct<k:int,count(b):bigint>
315+
struct<k:int,count(b) FILTER (b > 0):bigint>
316316
-- !query 29 output
317317
1 2
318318
2 2
@@ -327,7 +327,7 @@ SELECT emp.dept_id,
327327
FROM emp
328328
GROUP BY dept_id
329329
-- !query 30 schema
330-
struct<dept_id:int,avg(salary):double,avg(salary):double>
330+
struct<dept_id:int,avg(salary):double,avg(salary) FILTER (id > scalarsubquery()):double>
331331
-- !query 30 output
332332
10 133.33333333333334 NULL
333333
100 400.0 400.0
@@ -344,7 +344,7 @@ SELECT emp.dept_id,
344344
FROM emp
345345
GROUP BY dept_id
346346
-- !query 31 schema
347-
struct<dept_id:int,avg(salary):double,avg(salary):double>
347+
struct<dept_id:int,avg(salary):double,avg(salary) FILTER (dept_id = scalarsubquery()):double>
348348
-- !query 31 output
349349
10 133.33333333333334 133.33333333333334
350350
100 400.0 NULL
@@ -366,7 +366,7 @@ GROUP BY dept_id
366366
struct<>
367367
-- !query 32 output
368368
org.apache.spark.sql.AnalysisException
369-
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, avg(salary#x) AS avg(salary)#x, avg(salary#x) AS avg(salary)#x]
369+
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, avg(salary#x) AS avg(salary)#x, avg(salary#x) filter exists#x [dept_id#x] AS avg(salary) FILTER exists(dept_id)#x]
370370
: +- Project [state#x]
371371
: +- Filter (dept_id#x = outer(dept_id#x))
372372
: +- SubqueryAlias `dept`
@@ -392,7 +392,7 @@ GROUP BY dept_id
392392
struct<>
393393
-- !query 33 output
394394
org.apache.spark.sql.AnalysisException
395-
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, sum(salary#x) AS sum(salary)#x, sum(salary#x) AS sum(salary)#x]
395+
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, sum(salary#x) AS sum(salary)#x, sum(salary#x) filter NOT exists#x [dept_id#x] AS sum(salary) FILTER (NOT exists(dept_id))#x]
396396
: +- Project [state#x]
397397
: +- Filter (dept_id#x = outer(dept_id#x))
398398
: +- SubqueryAlias `dept`
@@ -417,7 +417,7 @@ GROUP BY dept_id
417417
struct<>
418418
-- !query 34 output
419419
org.apache.spark.sql.AnalysisException
420-
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, avg(salary#x) AS avg(salary)#x, avg(salary#x) AS avg(salary)#x]
420+
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, avg(salary#x) AS avg(salary)#x, avg(salary#x) filter dept_id#x IN (list#x []) AS avg(salary) FILTER (dept_id IN (listquery()))#x]
421421
: +- Distinct
422422
: +- Project [dept_id#x]
423423
: +- SubqueryAlias `dept`
@@ -442,7 +442,7 @@ GROUP BY dept_id
442442
struct<>
443443
-- !query 35 output
444444
org.apache.spark.sql.AnalysisException
445-
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, sum(salary#x) AS sum(salary)#x, sum(salary#x) AS sum(salary)#x]
445+
IN/EXISTS predicate sub-queries can only be used in Filter/Join and a few commands: Aggregate [dept_id#x], [dept_id#x, sum(salary#x) AS sum(salary)#x, sum(salary#x) filter NOT dept_id#x IN (list#x []) AS sum(salary) FILTER (NOT (dept_id IN (listquery())))#x]
446446
: +- Distinct
447447
: +- Project [dept_id#x]
448448
: +- SubqueryAlias `dept`

sql/core/src/test/resources/sql-tests/results/postgreSQL/aggregates_part3.sql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ It is not allowed to use an aggregate function in the argument of another aggreg
1414
-- !query 1
1515
select min(unique1) filter (where unique1 > 100) from tenk1
1616
-- !query 1 schema
17-
struct<min(unique1):int>
17+
struct<min(unique1) FILTER (unique1 > 100):int>
1818
-- !query 1 output
1919
101
2020

2121

2222
-- !query 2
2323
select sum(1/ten) filter (where ten > 0) from tenk1
2424
-- !query 2 schema
25-
struct<sum((CAST(1 AS DOUBLE) / CAST(ten AS DOUBLE))):double>
25+
struct<sum((CAST(1 AS DOUBLE) / CAST(ten AS DOUBLE))) FILTER (ten > 0):double>
2626
-- !query 2 output
2727
2828.9682539682954
2828

0 commit comments

Comments
 (0)