Skip to content

ClickHouse External Table takes derived(aliased) column as normal, thus cause error when write to it #809

@yaboyang

Description

@yaboyang

The ClickHouse External Table pulls metadata from ClickHouse by itself. It's convenient but it takes derived columns as normal. And it put all columns into generated insert statement, which sent to ClickHouse, though you select partial columns in proton side. And then a "No such column" error raised if there's one aliased column.

How to reproduce
It should be quite clear.
create table aliased_column(pk Int32, v1 Int32, v2 Int32, s Int32 alias v1 + v2) engine = MergeTree order by pk;
CREATE EXTERNAL TABLE ch_test SETTINGS type='clickhouse', ...
insert into ch_test (pk, v1, v2) values (1, 1, 2)

And then:
Code: 16. DB::Exception: Received from localhost:8463. DB::Exception: Received from xxxx:9000. DB::Exception: No such column s in table default.aliased_column

Proton Version is 1.5.13 revision 54459

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions