Ajo Thomas created SAMZA-2640:
---------------------------------
Summary: Issues in code examples in Samza official doc
Key: SAMZA-2640
URL: https://issues.apache.org/jira/browse/SAMZA-2640
Project: Samza
Issue Type: Bug
Reporter: Ajo Thomas
The code examples in Samza official doc section High Level API - Window Types
([https://samza.apache.org/learn/documentation/latest/api/high-level-api.html#window-types])
have some issues.
For Tumbling Window, this line of code does not have variable name.
{code:java}
MessageStream<PageView> pageViews = ...
MessageStream<WindowPane<String, Collection<PageView>>> = pageViews.window(
Windows.keyedTumblingWindow(
pageView -> pageView.getUserId(), // key extractor
Duration.ofSeconds(30), // window duration
new StringSerde(), new JsonSerdeV2<>(PageView.class)));
{code}
For Session Window, this code sample is irrelevant and seems to be a result of
copy paste error.
{code:java}
// Compute the maximum value over tumbling windows of 30 seconds.
MessageStream<Integer> integers = …
Supplier<Integer> initialValue = () -> Integer.MAX_INT
FoldLeftFunction<Integer, Integer> aggregateFunction = (msg, oldValue) ->
Math.max(msg, oldValue)
MessageStream<WindowPane<Void, Integer>> windowedStream = integers.window(
Windows.tumblingWindow(
Duration.ofSeconds(30),
initialValue,
aggregateFunction,
new IntegerSerde()));
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)