Add test for function empty support uuid

This commit is contained in:
zxc111 2021-07-04 22:40:09 +08:00
parent 15a36af4d6
commit faa174c6c4
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,3 @@
1
0
2 1

View File

@ -0,0 +1,28 @@
SELECT empty(toUUID('00000000-0000-0000-0000-000000000000'));
SELECT uniqIf(uuid, empty(uuid))
FROM
(
SELECT toUUID('00000000-0000-0000-0000-000000000002') AS uuid
UNION ALL
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');
SET joined_subquery_requires_alias = 0;
SELECT
uniq(user_id) AS users,
uniqIf(order_id, notEmpty(order_id)) AS orders
FROM
(
SELECT * FROM uuid_empty.users
) ALL LEFT JOIN (
SELECT * FROM uuid_empty.orders
) USING (user_id);
DROP DATABASE uuid_empty;