kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohammed Ait Haddou <mohammedaithad...@gmail.com>
Subject Math percentage count in KSQLDB
Date Fri, 05 Jun 2020 15:59:26 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message