This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch ignite-21920
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 31421ebce45707897ea32b770891a13f11b07d08
Author: amashenkov <[email protected]>
AuthorDate: Mon Apr 8 17:51:02 2024 +0300

    Add test.
---
 .../group/test_group_by_not_in_select.test         | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git 
a/modules/sql-engine/src/integrationTest/sql/aggregate/group/test_group_by_not_in_select.test
 
b/modules/sql-engine/src/integrationTest/sql/aggregate/group/test_group_by_not_in_select.test
new file mode 100644
index 0000000000..8a472998ca
--- /dev/null
+++ 
b/modules/sql-engine/src/integrationTest/sql/aggregate/group/test_group_by_not_in_select.test
@@ -0,0 +1,45 @@
+# name: test/sql/aggregate/group/test_group_by_not_in_select.test
+# description: Test group by statements has no restriction that group by 
clause can contains column not in the select list.
+# feature: E051-04
+# group: [group]
+
+statement ok
+PRAGMA enable_verification
+
+statement ok
+CREATE TABLE test (a INTEGER, b INTEGER);
+
+statement ok
+INSERT INTO test VALUES (11, 22), (13, 22), (12, 21)
+
+query R rowsort
+SELECT SUM(a) FROM test GROUP BY b;
+----
+12.000000
+24.000000
+
+query R
+SELECT SUM(a) FROM test GROUP BY b ORDER BY COUNT(a);
+----
+12.000000
+24.000000
+
+query R
+SELECT SUM(a) FROM test GROUP BY b ORDER BY COUNT(a) DESC;
+----
+24.000000
+12.000000
+
+# multi-columns
+statement ok
+CREATE TABLE integers(i INTEGER, j INTEGER, k INTEGER);
+
+statement ok
+INSERT INTO integers VALUES (1, 1, 2), (1, 2, 2), (1, 1, 2), (2, 1, 2), (1, 2, 
4), (1, 2, NULL);
+
+query RI rowsort
+SELECT SUM(k), COUNT(k) FROM integers GROUP BY i, j
+----
+2.000000       1
+4.000000       2
+6.000000       2

Reply via email to