diff --git a/dbms/tests/queries/0_stateless/00098_1_union_all.reference b/dbms/tests/queries/0_stateless/00098_1_union_all.reference index 1191247b6d9..8fc0e85e8fb 100644 --- a/dbms/tests/queries/0_stateless/00098_1_union_all.reference +++ b/dbms/tests/queries/0_stateless/00098_1_union_all.reference @@ -1,2 +1,2 @@ -1 -2 +1000 +2000 diff --git a/dbms/tests/queries/0_stateless/00098_1_union_all.sql b/dbms/tests/queries/0_stateless/00098_1_union_all.sql index 6114f5cfaef..51cc27a7d73 100644 --- a/dbms/tests/queries/0_stateless/00098_1_union_all.sql +++ b/dbms/tests/queries/0_stateless/00098_1_union_all.sql @@ -1 +1,20 @@ -SELECT 1 UNION ALL SELECT 2; +DROP TABLE IF EXISTS data2013; +DROP TABLE IF EXISTS data2014; + +CREATE TABLE data2013 (name String, value UInt32) ENGINE = TinyLog; +CREATE TABLE data2014 (name String, value UInt32) ENGINE = TinyLog; + +INSERT INTO data2013(name,value) VALUES('Alice', 1000); +INSERT INTO data2013(name,value) VALUES('Bob', 2000); +INSERT INTO data2013(name,value) VALUES('Carol', 5000); + +INSERT INTO data2014(name,value) VALUES('Alice', 2000); +INSERT INTO data2014(name,value) VALUES('Bob', 2000); +INSERT INTO data2014(name,value) VALUES('Dennis', 35000); + +SELECT val FROM +(SELECT value AS val FROM data2013 WHERE name = 'Alice' +UNION ALL +SELECT value AS val FROM data2014 WHERE name = 'Alice') +ORDER BY val ASC; + diff --git a/dbms/tests/queries/0_stateless/00098_2_union_all.reference b/dbms/tests/queries/0_stateless/00098_2_union_all.reference index 1191247b6d9..8fc0e85e8fb 100644 --- a/dbms/tests/queries/0_stateless/00098_2_union_all.reference +++ b/dbms/tests/queries/0_stateless/00098_2_union_all.reference @@ -1,2 +1,2 @@ -1 -2 +1000 +2000 diff --git a/dbms/tests/queries/0_stateless/00098_2_union_all.sql b/dbms/tests/queries/0_stateless/00098_2_union_all.sql index 88f24d7f00b..6666065efa0 100644 --- a/dbms/tests/queries/0_stateless/00098_2_union_all.sql +++ b/dbms/tests/queries/0_stateless/00098_2_union_all.sql @@ -1 +1,6 @@ -SELECT 1 UNION ALL SELECT 2; +SELECT val FROM +(SELECT value AS val FROM data2013 WHERE name = 'Alice' +UNION ALL +SELECT value AS val FROM data2014 WHERE name = 'Alice') +ORDER BY val ASC; + diff --git a/dbms/tests/queries/0_stateless/00098_3_union_all.reference b/dbms/tests/queries/0_stateless/00098_3_union_all.reference index 1191247b6d9..8fc0e85e8fb 100644 --- a/dbms/tests/queries/0_stateless/00098_3_union_all.reference +++ b/dbms/tests/queries/0_stateless/00098_3_union_all.reference @@ -1,2 +1,2 @@ -1 -2 +1000 +2000 diff --git a/dbms/tests/queries/0_stateless/00098_3_union_all.sql b/dbms/tests/queries/0_stateless/00098_3_union_all.sql index 776460cd183..52b0d0a7133 100644 --- a/dbms/tests/queries/0_stateless/00098_3_union_all.sql +++ b/dbms/tests/queries/0_stateless/00098_3_union_all.sql @@ -1,2 +1,6 @@ -SELECT 1 UNION /*comment*/ ALL SELECT 2; +SELECT val FROM +(SELECT value AS val FROM data2013 WHERE name = 'Alice' +UNION /*comment*/ ALL +SELECT value AS val FROM data2014 WHERE name = 'Alice') +ORDER BY val ASC; diff --git a/dbms/tests/queries/0_stateless/00098_4_union_all.reference b/dbms/tests/queries/0_stateless/00098_4_union_all.reference index 9355227d376..2f486f4ce0f 100644 --- a/dbms/tests/queries/0_stateless/00098_4_union_all.reference +++ b/dbms/tests/queries/0_stateless/00098_4_union_all.reference @@ -1,3 +1,3 @@ -1 2 -3 4 -5 6 +1000 +2000 +35000 diff --git a/dbms/tests/queries/0_stateless/00098_4_union_all.sql b/dbms/tests/queries/0_stateless/00098_4_union_all.sql index 711b0c3b032..179a54c815b 100644 --- a/dbms/tests/queries/0_stateless/00098_4_union_all.sql +++ b/dbms/tests/queries/0_stateless/00098_4_union_all.sql @@ -1 +1,7 @@ -SELECT 1,2 UNION ALL SELECT 3,4 UNION ALL SELECT 5,6; +SELECT val FROM +(SELECT value AS val FROM data2013 WHERE name = 'Alice' +UNION ALL +SELECT value AS val FROM data2014 WHERE name = 'Alice' +UNION ALL +SELECT value AS val FROM data2014 WHERE name = 'Dennis') +ORDER BY val ASC; diff --git a/dbms/tests/queries/0_stateless/00098_5_union_all.sql b/dbms/tests/queries/0_stateless/00098_5_union_all.sql index 2def5c03a8f..108296964fa 100644 --- a/dbms/tests/queries/0_stateless/00098_5_union_all.sql +++ b/dbms/tests/queries/0_stateless/00098_5_union_all.sql @@ -1,15 +1 @@ -DROP TABLE IF EXISTS data2013; -DROP TABLE IF EXISTS data2014; - -CREATE TABLE data2013 (name String, value UInt32) ENGINE = Memory; -CREATE TABLE data2014 (name String, value UInt32) ENGINE = Memory; - -INSERT INTO data2013(name,value) VALUES('Alice', 1000); -INSERT INTO data2013(name,value) VALUES('Bob', 2000); -INSERT INTO data2013(name,value) VALUES('Carol', 5000); - -INSERT INTO data2014(name,value) VALUES('Alice', 2000); -INSERT INTO data2014(name,value) VALUES('Bob', 2000); -INSERT INTO data2014(name,value) VALUES('Dennis', 35000); - SELECT nn,vv FROM (SELECT name AS nn, value AS vv FROM data2013 UNION ALL SELECT name AS nn, value AS vv FROM data2014) ORDER BY nn ASC;