Nikita Fomichev 2024-04-03 09:48:36 +02:00
parent cf8a83bb36
commit d7827eaf57
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
-- https://github.com/ClickHouse/ClickHouse/issues/23104
DROP DATABASE IF EXISTS test_03053;
CREATE DATABASE test_03053;
CREATE TABLE test_03053.base
(
`id` UInt64,
`id2` UInt64,
`d` UInt64,
`value` UInt64
)
ENGINE=MergeTree()
PARTITION BY d
ORDER BY (id,id2,d);
CREATE TABLE test_03053.derived1
(
`id1` UInt64,
`d1` UInt64,
`value1` UInt64
)
ENGINE = MergeTree()
PARTITION BY d1
ORDER BY (id1, d1);
CREATE TABLE test_03053.derived2
(
`id2` UInt64,
`d2` UInt64,
`value2` UInt64
)
ENGINE = MergeTree()
PARTITION BY d2
ORDER BY (id2, d2);
SELECT
base.id AS `base.id`,
derived2.id2 AS `derived2.id2`,
derived2.value2 AS `derived2.value2`,
derived1.value1 AS `derived1.value1`
FROM test_03053.base AS base
LEFT JOIN test_03053.derived2 AS derived2 ON base.id2 = derived2.id2
LEFT JOIN test_03053.derived1 AS derived1 ON base.id = derived1.id1;