You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Marco Lotz (Jira)" <ji...@apache.org> on 2022/07/07 20:06:00 UTC
[jira] [Commented] (KAFKA-12943) Bug in Kafka Streams Documentation (Aggregating)
[ https://issues.apache.org/jira/browse/KAFKA-12943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17563944#comment-17563944 ]
Marco Lotz commented on KAFKA-12943:
------------------------------------
The PR was raised in April and approved twice. Is there anything else missing to merge it to trunk?
> Bug in Kafka Streams Documentation (Aggregating)
> ------------------------------------------------
>
> Key: KAFKA-12943
> URL: https://issues.apache.org/jira/browse/KAFKA-12943
> Project: Kafka
> Issue Type: Bug
> Components: documentation, streams
> Reporter: Rajesh KSV
> Assignee: Marco Lotz
> Priority: Minor
>
> 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}
> Generic types are missing. 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.20.10#820010)