wangyum commented on a change in pull request #25151: [SPARK-28387][SQL][TEST] 
Port select_having.sql
URL: https://github.com/apache/spark/pull/25151#discussion_r303248744
 
 

 ##########
 File path: 
sql/core/src/test/resources/sql-tests/results/pgSQL/select_having.sql.out
 ##########
 @@ -0,0 +1,187 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 22
+
+
+-- !query 0
+CREATE TABLE test_having (a int, b int, c string, d string) USING parquet
+-- !query 0 schema
+struct<>
+-- !query 0 output
+
+
+
+-- !query 1
+INSERT INTO test_having VALUES (0, 1, 'XXXX', 'A')
+-- !query 1 schema
+struct<>
+-- !query 1 output
+
+
+
+-- !query 2
+INSERT INTO test_having VALUES (1, 2, 'AAAA', 'b')
+-- !query 2 schema
+struct<>
+-- !query 2 output
+
+
+
+-- !query 3
+INSERT INTO test_having VALUES (2, 2, 'AAAA', 'c')
+-- !query 3 schema
+struct<>
+-- !query 3 output
+
+
+
+-- !query 4
+INSERT INTO test_having VALUES (3, 3, 'BBBB', 'D')
+-- !query 4 schema
+struct<>
+-- !query 4 output
+
+
+
+-- !query 5
+INSERT INTO test_having VALUES (4, 3, 'BBBB', 'e')
+-- !query 5 schema
+struct<>
+-- !query 5 output
+
+
+
+-- !query 6
+INSERT INTO test_having VALUES (5, 3, 'bbbb', 'F')
+-- !query 6 schema
+struct<>
+-- !query 6 output
+
+
+
+-- !query 7
+INSERT INTO test_having VALUES (6, 4, 'cccc', 'g')
+-- !query 7 schema
+struct<>
+-- !query 7 output
+
+
+
+-- !query 8
+INSERT INTO test_having VALUES (7, 4, 'cccc', 'h')
+-- !query 8 schema
+struct<>
+-- !query 8 output
+
+
+
+-- !query 9
+INSERT INTO test_having VALUES (8, 4, 'CCCC', 'I')
+-- !query 9 schema
+struct<>
+-- !query 9 output
+
+
+
+-- !query 10
+INSERT INTO test_having VALUES (9, 4, 'CCCC', 'j')
+-- !query 10 schema
+struct<>
+-- !query 10 output
+
+
+
+-- !query 11
+SELECT b, c FROM test_having
+       GROUP BY b, c HAVING count(*) = 1 ORDER BY b, c
+-- !query 11 schema
+struct<b:int,c:string>
+-- !query 11 output
+1      XXXX
+3      bbbb
+
+
+-- !query 12
+SELECT b, c FROM test_having
+       GROUP BY b, c HAVING b = 3 ORDER BY b, c
+-- !query 12 schema
+struct<b:int,c:string>
+-- !query 12 output
+3      BBBB
+3      bbbb
+
+
+-- !query 13
+SELECT c, max(a) FROM test_having
+       GROUP BY c HAVING count(*) > 2 OR min(a) = max(a)
+       ORDER BY c
+-- !query 13 schema
+struct<c:string,max(a):int>
+-- !query 13 output
+XXXX   0
+bbbb   5
+
+
+-- !query 14
+SELECT min(a), max(a) FROM test_having HAVING min(a) = max(a)
+-- !query 14 schema
+struct<min(a):int,max(a):int>
+-- !query 14 output
+
+
+
+-- !query 15
+SELECT min(a), max(a) FROM test_having HAVING min(a) < max(a)
+-- !query 15 schema
+struct<min(a):int,max(a):int>
+-- !query 15 output
+0      9
+
+
+-- !query 16
+SELECT a FROM test_having HAVING min(a) < max(a)
+-- !query 16 schema
+struct<>
+-- !query 16 output
+org.apache.spark.sql.AnalysisException
 
 Review comment:
   PostgreSQL throws:
   ```
   ERROR:  column "test_having.a" must appear in the GROUP BY clause or be used 
in an aggregate function
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to