Reputation: 7
I am new to Ksql and trying aggregation, have created a Kstream & a Ktable which looks like this
kstream...
CREATE STREAM test
(id BIGINT,
type VARCHAR,
sales BIGINT
WITH (KAFKA_TOPIC='test1',
VALUE_FORMAT='JSON');
ktable...
CREATE TABLE test_total AS
SELECT ID,
SUM(SALES) AS TOTAL_SALES
FROM test
GROUP BY ID
EMIT CHANGES;
Published these values into Kafka test1 topic
{"id": 1, "type": "test","sales": 200}
{"id": 1, "type": "test","sales": 300}
When I use the Kafka console consumer I only see the output as
{"TOTAL_SALES":200} {"TOTAL_SALES":500}
How can I see the id also printed into the Kafka topic? Do I have to create some kind of view out of the table?
Upvotes: 0
Views: 688
Reputation: 62350
In ksqlDB, primitive types are serialized as primitive types into the topic.
Cf https://docs.ksqldb.io/en/latest/reference/serialization/
There is not much you can do about it atm.
Upvotes: 0
Reputation: 1831
In your console-consumer command add
--property print.key=true
If you already using ksql, you can also SELECT from your created TABLE
Upvotes: 1