You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Rajesh KSV (Jira)" <ji...@apache.org> on 2021/06/12 02:22:00 UTC
[jira] [Created] (KAFKA-12943) Bug in Kafka Streams Documentation
(Aggregating)
Rajesh KSV created KAFKA-12943:
----------------------------------
Summary: Bug in Kafka Streams Documentation (Aggregating)
Key: KAFKA-12943
URL: https://issues.apache.org/jira/browse/KAFKA-12943
Project: Kafka
Issue Type: Bug
Reporter: Rajesh KSV
In the doc, for aggregating function, the example is incorrect
[https://kafka.apache.org/documentation/streams/developer-guide/dsl-api.html#aggregating]
It says
{code:java}
KTable<byte[], Long> aggregatedStream = groupedStream.aggregate(
() -> 0L, /* initializer */
(aggKey, newValue, aggValue) -> aggValue + newValue.length(), /* adder */
Materialized.as("aggregated-stream-store") /* state store name */
.withValueSerde(Serdes.Long()); /* serde for aggregate value */{code}
Instead, it should be
{code:java}
KTable<byte[], Long> aggregatedStream = groupedStream.aggregate(
() -> 0L, /* initializer */
(aggKey, newValue, aggValue) -> aggValue + newValue.length(), /* adder */
Materialized.<String, Long, KeyValueStore<Bytes, byte[]>>as("aggregated-stream-store") /* state store name */
.withValueSerde(Serdes.Long()); /* serde for aggregate value */ {code}
Otherwise, code won't work. I myself verified it.
Reference
https://stackoverflow.com/questions/51040555/the-method-withvalueserde-in-the-type-materialized-is-not-applicable/51049472
--
This message was sent by Atlassian Jira
(v8.3.4#803005)