proton icon indicating copy to clipboard operation
proton copied to clipboard

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

Open yaboyang opened this issue 1 year ago • 0 comments

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

yaboyang avatar Jul 30 '24 07:07 yaboyang