You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Josep Prat (Jira)" <ji...@apache.org> on 2021/06/15 07:51: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=17363441#comment-17363441 ] 

Josep Prat commented on KAFKA-12943:
------------------------------------

There is a PR for this already: https://github.com/apache/kafka/pull/10766

> 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
>            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.3.4#803005)