Repository navigation
Closed
Labels
bugConfirmed user-visible misbehaviour in official release
Description
Describe the unexpected behaviour
Union All in combination with joins breaks when upgrading to Clickhouse 20.5.2.7
How to reproduce
- Which ClickHouse server version to use: 20.5.2.7
- Which interface to use, if matters: HTTP (but should not matter)
- Non-default settings, if any (none that I am aware of)
Please see the following queries:
CREATE TABLE tableCommon (
`key` FixedString(15),
`value` Nullable(Int8)
) ENGINE = Log();
CREATE TABLE tableTrees (
`key` FixedString(15),
`name` Nullable(Int8),
`name2` Nullable(Int8)
) ENGINE = Log();
CREATE TABLE tableFlowers (
`key` FixedString(15),
`name` Nullable(Int8)
) ENGINE = Log()
;
SELECT * FROM (
SELECT common.key, common.value, trees.name, trees.name2
FROM (
SELECT *
FROM tableCommon
) as common
INNER JOIN (
SELECT *
FROM tableTrees
) trees ON (common.key = trees.key)
)
UNION ALL
(
SELECT common.key, common.value,
-- Variant 1
null as name, null as name2
-- OR Variant 2
-- flowers.name, null as name2
FROM (
SELECT *
FROM tableCommon
) as common
INNER JOIN (
SELECT *
FROM tableFlowers
) flowers ON (common.key = flowers.key)
)Expected behavior
The query should run without an error.
Error message and/or stacktrace
The query returns the following error:
ClickHouse exception, code: 171, host: my.clickhouse.host, port: 8080; Code: 171, e.displayText() = DB::Exception: Block structure mismatch in function connect between Converting and Concat stream: different number of columns:
key FixedString(15) FixedString(size = 0), value Nullable(Int8) Nullable(size = 0, Int8(size = 0), UInt8(size = 0)), name Nullable(Int8) Nullable(size = 0, Int8(size = 0), UInt8(size = 0)), name2 Nullable(Int8) Nullable(size = 0, Int8(size = 0), UInt8(size = 0)) (version 20.5.2.7 (official build))
Additional context
As you can see, there is no data in play at all. The error message is generated just from the raw structure. The first and the second part of the UNION ALL work when running them on their own.
Commenting out the last INNER JOIN (the one with the alias flowers) makes the issue disappear. This would also mean that the null as name, null as name2 is not the culprit here.
Reacted by Ilya Barbashov and Alexey
Metadata
Metadata
Assignees
Labels
bugConfirmed user-visible misbehaviour in official release
Activity
millin commentedon Jul 24, 2020
I have the same error
ver 20.5.3.27
4ertus2 commentedon Jul 27, 2020
Smaller sample