Oleksiy Illyashov
unread,Dec 9, 2022, 11:27:04 PM12/9/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ClickHouse
Hi,
trying to create MV to get latest record values, but getting error messages for any type of fields. Code sample:
CREATE TABLE from_table
(
id UInt32,
version UInt32,
value Int32
)
ENGINE = MergeTree()
PARTITION BY tuple()
order by id;
insert into from_table values (1, 1, 0);
insert into from_table values (1, 2, 5);
insert into from_table values (1, 3, 3);
CREATE TABLE to_table
(
id UInt32,
value AggregateFunction(argMax, UInt32, UInt32)
)
ENGINE = AggregatingMergeTree
PARTITION BY tuple()
order by id;
CREATE MATERIALIZED VIEW to_table_mv
to to_table
AS
SELECT id, argMaxState(value,version) as value
from from_table
group by id;
last statement(
CREATE MATERIALIZED VIEW to_table_mv ...) generates error message:
SQL Error [70] [07000]: Code: 70. DB::Exception: Conversion from AggregateFunction(argMax, Int32, UInt32) to AggregateFunction(argMax, UInt32, UInt32) is not supported: while converting source column value to destination column value. (CANNOT_CONVERT_TYPE) (version 22.12.1.392 (official build))
Any ideas?
Thanks a lot,
Alex