ClickHouse/dbms/tests/queries/0_stateless/00506_global_in_union.sql
proller 1e961cc69d Fix complex queries with GLOBAL IN and UNION ALL (#CLICKHOUSE-3356) (#1339)
* TEST only: why initQueryAnalyzer ?

* Better tests

* missing file

* Missing file

* Add test

* Test fixes

* Fixed FREEZE PARTITION: using only active data parts; acquire snapshot of parts [#CLICKHOUSE-3369].

* Removed tcp_ssl_port by default [#CLICKHOUSE-2].

* Better tests

* comment

* clean

* REmove wrong code

* clean
2017-10-13 00:28:24 +03:00

18 lines
1.2 KiB
SQL

SELECT X FROM (SELECT * FROM (SELECT 1 AS X, 2 AS Y) UNION ALL SELECT 3, 4) ORDER BY X;
DROP TABLE IF EXISTS test.globalin;
CREATE TABLE test.globalin (CounterID UInt32, StartDate Date ) ENGINE = Memory;
INSERT INTO test.globalin VALUES (34, toDate('2017-10-02')), (42, toDate('2017-10-02')), (55, toDate('2017-10-01'));
SELECT * FROM ( SELECT CounterID FROM remote('localhost', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID);
SELECT 'NOW okay =========================:';
SELECT CounterID FROM remote('127.0.0.1', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34) )) GROUP BY CounterID UNION ALL SELECT CounterID FROM remote('localhost', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID;
SELECT 'NOW BAD ==========================:';
SELECT * FROM ( SELECT CounterID FROM remote('127.0.0.1', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34) )) GROUP BY CounterID UNION ALL SELECT CounterID FROM remote('localhost', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID);
SELECT 'finish ===========================;';
DROP TABLE test.globalin;