Skip to content

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

@alsugiliazova

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. 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions