You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sql/core/src/test/resources/sql-tests/results/group-by-filter.sql.out
+31-31Lines changed: 31 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -51,53 +51,53 @@ SELECT a, COUNT(b) FILTER (WHERE a >= 2) FROM testData
51
51
struct<>
52
52
-- !query 3 output
53
53
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.;
55
55
56
56
57
57
-- !query 4
58
58
SELECT COUNT(a) FILTER (WHERE a = 1), COUNT(b) FILTER (WHERE a > 1) FROM testData
59
59
-- !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>
61
61
-- !query 4 output
62
62
2 4
63
63
64
64
65
65
-- !query 5
66
66
SELECT COUNT(id) FILTER (WHERE hiredate = date "2001-01-01") FROM emp
67
67
-- !query 5 schema
68
-
struct<count(id):bigint>
68
+
struct<count(id) FILTER (hiredate = DATE '2001-01-01'):bigint>
69
69
-- !query 5 output
70
70
2
71
71
72
72
73
73
-- !query 6
74
74
SELECT COUNT(id) FILTER (WHERE hiredate = to_date('2001-01-01 00:00:00')) FROM emp
struct<dept_id:int,count(DISTINCT emp_name):bigint,count(DISTINCT hiredate):bigint,sum(salary):double,sum(salary) FILTER (id > 200):double>
216
216
-- !query 20 output
217
217
10 2 2 400.0 NULL
218
218
100 2 2 800.0 800.0
@@ -225,7 +225,7 @@ NULL 1 1 400.0 400.0
225
225
-- !query 21
226
226
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
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]
370
370
: +- Project [state#x]
371
371
: +- Filter (dept_id#x = outer(dept_id#x))
372
372
: +- SubqueryAlias `dept`
@@ -392,7 +392,7 @@ GROUP BY dept_id
392
392
struct<>
393
393
-- !query 33 output
394
394
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]
396
396
: +- Project [state#x]
397
397
: +- Filter (dept_id#x = outer(dept_id#x))
398
398
: +- SubqueryAlias `dept`
@@ -417,7 +417,7 @@ GROUP BY dept_id
417
417
struct<>
418
418
-- !query 34 output
419
419
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]
421
421
: +- Distinct
422
422
: +- Project [dept_id#x]
423
423
: +- SubqueryAlias `dept`
@@ -442,7 +442,7 @@ GROUP BY dept_id
442
442
struct<>
443
443
-- !query 35 output
444
444
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]
0 commit comments