LargestTriangleThreeBuckets dowsampling and Materialized View chaining #62849
-
Hello, I am looking through the documentation for some of the interesting features in ClickHouse, and after experimenting I am having trouble figuring out if it is possible to use LTTB like the other aggregation functions. As an example, I can't figure out what is wrong with the following declaration: CREATE TABLE rawEvents (
dateTime DateTime64(3, 'UTC'),
value UInt32
)
ENGINE = MergeTree
ORDER BY dateTime;
CREATE TABLE downSampled
(
date_time DateTime64(3, 'UTC') NOT NULL,
down_sampled AggregateFunction(largestTriangleThreeBuckets(10), UInt32)
)
ENGINE = AggregatingMergeTree()
ORDER BY date_time;
CREATE MATERIALIZED VIEW downSampled_mv TO downSampled AS
SELECT toStartOfMinute(dateTime) AS dateTime,
largestTriangleThreeBuckets(10)(dateTime, value) AS updates
FROM rawEvents
GROUP BY dateTime;
INSERT INTO rawEvents (dateTime, value)
VALUES (now(), 1); This results in Code: 42. DB::Exception: Received from localhost:9000. DB::Exception: Aggregate function largestTriangleThreeBuckets requires two arguments. The guide to chaining materialized views state it takes the form What is the correct way to chain together LTTB materialized views? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Be careful with column names in MatView, they should match to column names in the destination table https://den-crane.github.io/Everything_you_should_know_about_materialized_views_commented.pdf
Also which dateTime do you want to use here https://fiddle.clickhouse.com/4531a768-3c2e-414e-afd6-765c9eb84ee9 |
Beta Was this translation helpful? Give feedback.
-
Also MatView with largestTriangleThreeBuckets has no sense. https://fiddle.clickhouse.com/d6fa9690-7c31-4df0-921d-79dbc3e20484 select to original/source data: 10 rows in set. Elapsed: 0.029 sec
select to materialized view: 10 rows in set. Elapsed: 0.111 sec. |
Beta Was this translation helpful? Give feedback.
Be careful with column names in MatView, they should match to column names in the destination table
https://den-crane.github.io/Everything_you_should_know_about_materialized_views_commented.pdf
Also which dateTime do you want to use here
largestTriangleThreeBuckets(10)(dateTime, value)
?rawE…