From b349309e44505bb78a93a547bee3d92c19de4206 Mon Sep 17 00:00:00 2001 From: amianthus <49116958+SirTenzin@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:32:13 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20group=20by=20being=20weir?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../materializations/events_hourly_mv.datasource | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/tinybird/materializations/events_hourly_mv.datasource b/server/tinybird/materializations/events_hourly_mv.datasource index aa67398b0..09a8f6e94 100644 --- a/server/tinybird/materializations/events_hourly_mv.datasource +++ b/server/tinybird/materializations/events_hourly_mv.datasource @@ -1,6 +1,9 @@ DESCRIPTION > Hourly aggregates with native JSON data type for properties. Allows multi-property GROUP BY at query time via properties.field syntax. + Uses MergeTree (not AggregatingMergeTree) to preserve distinct property + combinations — the MV pipe's GROUP BY handles pre-aggregation at insert + time, and query-time sum() in the pipes handles the final rollup. SCHEMA > `org_id` String, @@ -9,9 +12,9 @@ SCHEMA > `event_name` String, `hour` DateTime, `properties` JSON, - `total_value` SimpleAggregateFunction(sum, Float64), - `event_count` SimpleAggregateFunction(sum, UInt64) + `total_value` Float64, + `event_count` UInt64 -ENGINE "AggregatingMergeTree" +ENGINE "MergeTree" ENGINE_PARTITION_KEY "toYYYYMM(hour)" ENGINE_SORTING_KEY "org_id, env, event_name, hour, customer_id"