diff options
Diffstat (limited to 'sql/core/src/test/resources/sql-tests')
-rw-r--r-- | sql/core/src/test/resources/sql-tests/inputs/group-by-ordinal.sql | 6 | ||||
-rw-r--r-- | sql/core/src/test/resources/sql-tests/results/group-by-ordinal.sql.out | 28 |
2 files changed, 28 insertions, 6 deletions
diff --git a/sql/core/src/test/resources/sql-tests/inputs/group-by-ordinal.sql b/sql/core/src/test/resources/sql-tests/inputs/group-by-ordinal.sql index 36b469c617..9c8d851e36 100644 --- a/sql/core/src/test/resources/sql-tests/inputs/group-by-ordinal.sql +++ b/sql/core/src/test/resources/sql-tests/inputs/group-by-ordinal.sql @@ -43,6 +43,12 @@ select a, rand(0), sum(b) from data group by a, 2; -- negative case: star select * from data group by a, b, 1; +-- group by ordinal followed by order by +select a, count(a) from (select 1 as a) tmp group by 1 order by 1; + +-- group by ordinal followed by having +select count(a), a from (select 1 as a) tmp group by 2 having a > 0; + -- turn of group by ordinal set spark.sql.groupByOrdinal=false; diff --git a/sql/core/src/test/resources/sql-tests/results/group-by-ordinal.sql.out b/sql/core/src/test/resources/sql-tests/results/group-by-ordinal.sql.out index 2f10b7ebc6..9c3a145f3a 100644 --- a/sql/core/src/test/resources/sql-tests/results/group-by-ordinal.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/group-by-ordinal.sql.out @@ -1,5 +1,5 @@ -- Automatically generated by SQLQueryTestSuite --- Number of queries: 17 +-- Number of queries: 19 -- !query 0 @@ -153,16 +153,32 @@ Star (*) is not allowed in select list when GROUP BY ordinal position is used; -- !query 15 -set spark.sql.groupByOrdinal=false +select a, count(a) from (select 1 as a) tmp group by 1 order by 1 -- !query 15 schema -struct<key:string,value:string> +struct<a:int,count(a):bigint> -- !query 15 output -spark.sql.groupByOrdinal +1 1 -- !query 16 -select sum(b) from data group by -1 +select count(a), a from (select 1 as a) tmp group by 2 having a > 0 -- !query 16 schema -struct<sum(b):bigint> +struct<count(a):bigint,a:int> -- !query 16 output +1 1 + + +-- !query 17 +set spark.sql.groupByOrdinal=false +-- !query 17 schema +struct<key:string,value:string> +-- !query 17 output +spark.sql.groupByOrdinal + + +-- !query 18 +select sum(b) from data group by -1 +-- !query 18 schema +struct<sum(b):bigint> +-- !query 18 output 9 |