23 lines
693 B
Plaintext
23 lines
693 B
Plaintext
DESCRIPTION >
|
|
Materializes events into hourly aggregates with native JSON properties.
|
|
Allows multi-property GROUP BY via properties.field syntax.
|
|
|
|
NODE materialize
|
|
SQL >
|
|
SELECT
|
|
org_id,
|
|
env,
|
|
customer_id,
|
|
event_name,
|
|
coalesce(entity_id, '') as entity_id,
|
|
internal_product_id,
|
|
toStartOfHour(timestamp) as hour,
|
|
CAST(coalesce(properties, '{}') AS JSON) as properties,
|
|
sum(toFloat64(coalesce(value, 1))) as total_value,
|
|
count() as event_count
|
|
FROM events
|
|
GROUP BY org_id, env, customer_id, event_name, entity_id, internal_product_id, hour, properties
|
|
|
|
TYPE materialized
|
|
DATASOURCE events_hourly_mv
|