You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by jo...@apache.org on 2024/04/10 10:27:42 UTC

(ignite-3) branch main updated: IGNITE-21917: Cover SQL T434 (GROUP BY DISTINCT) feature by tests (#3580)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 90b4e2418d IGNITE-21917: Cover SQL T434 (GROUP BY DISTINCT) feature by tests (#3580)
90b4e2418d is described below

commit 90b4e2418d1a2d82b851645d4de572fd1e42d414
Author: Max Zhuravkov <sh...@gmail.com>
AuthorDate: Wed Apr 10 13:27:36 2024 +0300

    IGNITE-21917: Cover SQL T434 (GROUP BY DISTINCT) feature by tests (#3580)
---
 .../aggregate/group/test_group_by_distinct.test    | 98 ++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/modules/sql-engine/src/integrationTest/sql/aggregate/group/test_group_by_distinct.test b/modules/sql-engine/src/integrationTest/sql/aggregate/group/test_group_by_distinct.test
new file mode 100644
index 0000000000..4d6a784996
--- /dev/null
+++ b/modules/sql-engine/src/integrationTest/sql/aggregate/group/test_group_by_distinct.test
@@ -0,0 +1,98 @@
+# name: test/sql/aggregate/group/test_group_by_distinct.test
+# description: SQL feature T434 (GROUP BY DISTINCT)
+# group: [group]
+
+statement ok
+CREATE TABLE integers(id INTEGER PRIMARY KEY, val INTEGER)
+
+statement ok
+INSERT INTO integers VALUES(1, 1), (2, 2), (3, 3), (4, 4)
+
+query I rowsort
+SELECT val FROM integers GROUP BY DISTINCT GROUPING SETS ((val), (val))
+----
+1
+2
+3
+4
+
+query I rowsort
+SELECT val FROM integers GROUP BY ALL GROUPING SETS ((val), (val))
+----
+1
+1
+2
+2
+3
+3
+4
+4
+
+query R rowsort
+SELECT val FROM ( VALUES (1), (1.0::REAL), (1.0::REAL), (2::DOUBLE), (1.1::REAL), (2::DECIMAL(2)) ) t(val) GROUP BY ALL GROUPING SETS ((val), (val))
+----
+1.0
+1.0
+1.1
+1.1
+2.0
+2.0
+
+query R rowsort
+SELECT val FROM ( VALUES (1), (1.0::REAL), (2::DOUBLE), (1.1::REAL), (2::DECIMAL(2)) ) t(val) GROUP BY DISTINCT GROUPING SETS ((val), (val))
+----
+1.0
+1.1
+2.0
+
+# NOTE: Results include trailing whitespace
+query I rowsort
+SELECT val FROM ( VALUES ('abc'), ('ed'), ('f') ) t(val) GROUP BY DISTINCT GROUPING SETS ((val), (val))
+----
+abc
+ed 
+f  
+
+# NOTE: Results include trailing whitespace
+query T rowsort
+SELECT val FROM ( VALUES ('abc'), ('ed'), ('f') ) t(val) GROUP BY ALL GROUPING SETS ((val), (val))
+----
+abc
+abc
+ed 
+ed 
+f  
+f  
+
+query IT rowsort
+SELECT id, val FROM ( VALUES ('c4a0327c-44be-416d-ae90-75c05079789f'::UUID, 1), ('367fc6f1-40c3-4237-8545-3fd102d29134'::UUID, 2) ) t(val, id) GROUP BY ALL GROUPING SETS ((val, id), (id, val))
+----
+1	c4a0327c-44be-416d-ae90-75c05079789f
+1	c4a0327c-44be-416d-ae90-75c05079789f
+2	367fc6f1-40c3-4237-8545-3fd102d29134
+2	367fc6f1-40c3-4237-8545-3fd102d29134
+
+query I rowsort
+SELECT val FROM ( VALUES (NULL), (NULL) ) t(val) GROUP BY ALL GROUPING SETS ((val), (val))
+----
+NULL
+NULL
+
+query I rowsort
+SELECT val FROM ( VALUES (NULL), (NULL) ) t(val) GROUP BY DISTINCT GROUPING SETS ((val), (val))
+----
+NULL
+
+query I rowsort
+SELECT val FROM ( VALUES (NULL), ('c4a0327c-44be-416d-ae90-75c05079789f'::UUID), (NULL) ) t(val) GROUP BY ALL GROUPING SETS ((val), (val))
+----
+NULL
+NULL
+c4a0327c-44be-416d-ae90-75c05079789f
+c4a0327c-44be-416d-ae90-75c05079789f
+
+query I rowsort
+SELECT val FROM ( VALUES (NULL), ('c4a0327c-44be-416d-ae90-75c05079789f'::UUID), (NULL) ) t(val) GROUP BY DISTINCT GROUPING SETS ((val), (val))
+----
+c4a0327c-44be-416d-ae90-75c05079789f
+NULL