ClickHouse / ClickHouse/ClickHouse

UNION ALL with nulls can lead to 'Block structure mismatch'

Open
#58,098 5 comments 0 reactions 0 assignees View on GitHub
comp-query-analyzer enhancement
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

query
```
SELECT
NULL,
NULL
UNION ALL
SELECT
'xxx',
NULL
```

exception
```
Received exception from server (version 23.12.1):
Code: 352. DB::Exception: Received from localhost:9000. DB::Exception: Block structure mismatch in (columns with identical name must have identical structure) stream: different types:
NULL Nullable(String) Nullable(size = 0, String(size = 0), UInt8(size = 0))
NULL Nullable(Nothing) Const(size = 0, Nullable(size = 1, Nothing(size = 1), UInt8(size = 1))). (AMBIGUOUS_COLUMN_NAME)
(query: SELECT
NULL,
NULL
UNION ALL
SELECT
'xxx',
NULL
)
```

https://fiddle.clickhouse.com/278a40b0-80e6-49c5-9c9d-9e704773b917

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.