mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +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
|
||||
);
|
||||
|
||||
CREATE DATABASE uuid_empty;
|
||||
CREATE TABLE uuid_empty.users (user_id UUID) ENGINE = Memory;
|
||||
CREATE TABLE uuid_empty.orders (order_id UUID, user_id UUID) ENGINE = Memory;
|
||||
INSERT INTO uuid_empty.users VALUES ('00000000-0000-0000-0000-000000000001');
|
||||
INSERT INTO uuid_empty.users VALUES ('00000000-0000-0000-0000-000000000002');
|
||||
INSERT INTO uuid_empty.orders VALUES ('00000000-0000-0000-0000-000000000003', '00000000-0000-0000-0000-000000000001');
|
||||
DROP TABLE IF EXISTS users;
|
||||
DROP TABLE IF EXISTS orders;
|
||||
|
||||
CREATE TABLE users (user_id UUID) ENGINE = Memory;
|
||||
CREATE TABLE orders (order_id UUID, user_id UUID) ENGINE = Memory;
|
||||
|
||||
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
|
||||
uniq(user_id) AS users,
|
||||
uniqIf(order_id, notEmpty(order_id)) AS orders
|
||||
FROM
|
||||
(
|
||||
SELECT * FROM uuid_empty.users
|
||||
SELECT * FROM users
|
||||
) t1 ALL LEFT JOIN (
|
||||
SELECT * FROM uuid_empty.orders
|
||||
SELECT * FROM orders
|
||||
) t2 USING (user_id);
|
||||
|
||||
DROP DATABASE uuid_empty;
|
||||
DROP TABLE users;
|
||||
DROP TABLE orders;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user