I have a stream with an event_type field, possible values are (view, cart,
purchase).

CREATE STREAM events(event_type STRING)
WITH (KAFKA_TOPIC='events', VALUE_FORMAT='DELIMITED');

I want to count the total number of all events or percentage for each
event_type, and the number of events for each event_type into a single
table.

Desired results :

+------------+-------+------------+
| Event_type | Count | Percentage |
+------------+-------+------------+
|    view    | 6     | 0.5        |
+------------+-------+------------+
|    cart    | 3     | 0.25       |
+------------+-------+------------+
| purchase   | 3     | 0.25       |
+------------+-------+------------+

https://stackoverflow.com/questions/62206367/a-simple-math-percentage-count-in-ksqldb

-- 
4itmed

Reply via email to