Skip to content

Unexpected exception when left part of union all is regular but right part is cluster function #1181

Closed

Description

@alsugiliazova

Unexpected exception when left part of union all is regular but right part is cluster function.

SELECT *
FROM
(
    SELECT
        hostName(),
        count(),
        1
    FROM iceberg('http://minio:9000/warehouse/data3', 'admin', 'password') AS t1
    GROUP BY hostName()
    UNION ALL
    SELECT
        hostName(),
        count(),
        2
    FROM s3('http://minio:9000/warehouse/data3/data/**.parquet', 'admin', 'password') AS t2
    GROUP BY hostName()
    SETTINGS object_storage_cluster = 'replicated_cluster'
)
Received exception from server (version 25.8.9):
Code: 20. DB::Exception: Received from localhost:9000. DB::Exception: Number of columns doesn't match (source: 1 and result: 2). (NUMBER_OF_COLUMNS_DOESNT_MATCH)

But the inner query works:

SELECT
    hostName(),
    count(),
    1
FROM iceberg('http://minio:9000/warehouse/data3', 'admin', 'password') AS t1
GROUP BY hostName()
UNION ALL
SELECT
    hostName(),
    count(),
    2
FROM s3('http://minio:9000/warehouse/data3/data/**.parquet', 'admin', 'password') AS t2
GROUP BY hostName()
SETTINGS object_storage_cluster = 'replicated_cluster'
Query id: 4a790512-93d9-473a-ba0f-91d5a0bf518b

   ┌─hostName()──┬─count()─┬─1─┐
1. │ clickhouse3 │       4 │ 1 │
2. │ clickhouse1 │       2 │ 1 │
3. │ clickhouse2 │       2 │ 1 │
4. │ clickhouse3 │       2 │ 2 │
5. │ clickhouse1 │       6 │ 2 │
   └─────────────┴─────────┴───┘

5 rows in set. Elapsed: 0.024 sec. 

Activity

  1. added
    swarms
    on Dec 1, 2025
  2. alsugiliazova commented on Dec 1, 2025

    @alsugiliazova
    MemberAuthor

    This can be reproduced on upstream build with cluster function on the right.

  3. ianton-ru commented on Nov 3, 2026

    @ianton-ru

    Fixed in #2471 and #2490

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

antalyaantalya-25.8swarms

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions