mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Update 01936_empty_function_support_uuid.sql
This commit is contained in:
parent
faac204a1f
commit
3f5ef4afe0
@ -10,21 +10,26 @@ FROM
|
|||||||
SELECT toUUID('00000000-0000-0000-0000-000000000001') AS uuid
|
SELECT toUUID('00000000-0000-0000-0000-000000000001') AS uuid
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE DATABASE uuid_empty;
|
DROP TABLE IF EXISTS users;
|
||||||
CREATE TABLE uuid_empty.users (user_id UUID) ENGINE = Memory;
|
DROP TABLE IF EXISTS orders;
|
||||||
CREATE TABLE uuid_empty.orders (order_id UUID, user_id UUID) ENGINE = Memory;
|
|
||||||
INSERT INTO uuid_empty.users VALUES ('00000000-0000-0000-0000-000000000001');
|
CREATE TABLE users (user_id UUID) ENGINE = Memory;
|
||||||
INSERT INTO uuid_empty.users VALUES ('00000000-0000-0000-0000-000000000002');
|
CREATE TABLE orders (order_id UUID, user_id UUID) ENGINE = Memory;
|
||||||
INSERT INTO uuid_empty.orders VALUES ('00000000-0000-0000-0000-000000000003', '00000000-0000-0000-0000-000000000001');
|
|
||||||
|
INSERT INTO users VALUES ('00000000-0000-0000-0000-000000000001');
|
||||||
|
INSERT INTO users VALUES ('00000000-0000-0000-0000-000000000002');
|
||||||
|
INSERT INTO orders VALUES ('00000000-0000-0000-0000-000000000003', '00000000-0000-0000-0000-000000000001');
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
uniq(user_id) AS users,
|
uniq(user_id) AS users,
|
||||||
uniqIf(order_id, notEmpty(order_id)) AS orders
|
uniqIf(order_id, notEmpty(order_id)) AS orders
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT * FROM uuid_empty.users
|
SELECT * FROM users
|
||||||
) t1 ALL LEFT JOIN (
|
) t1 ALL LEFT JOIN (
|
||||||
SELECT * FROM uuid_empty.orders
|
SELECT * FROM orders
|
||||||
) t2 USING (user_id);
|
) t2 USING (user_id);
|
||||||
|
|
||||||
DROP DATABASE uuid_empty;
|
DROP TABLE users;
|
||||||
|
DROP TABLE orders;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user