[
https://issues.apache.org/jira/browse/FLINK-18283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aljoscha Krettek closed FLINK-18283.
------------------------------------
Fix Version/s: 1.11.0
Resolution: Fixed
release-1.11: 6348181376e4a8c7b8fa81321d2952c237a9541f
master: b32f098206d4cc58add88555b9c27f24191ad2bc
> Update outdated Javadoc for clear method of ProcessWindowFunction
> -----------------------------------------------------------------
>
> Key: FLINK-18283
> URL: https://issues.apache.org/jira/browse/FLINK-18283
> Project: Flink
> Issue Type: Improvement
> Components: API / Core, API / DataStream
> Reporter: Abhijit Shandilya
> Assignee: Abhijit Shandilya
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.11.0
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> +*Summary:*+
> Javadoc for ProcessWindowFunction has incorrect (outdated) information.
> +*Description:*+
> The current javadoc for
> [ProcessWindowFunction|https://ci.apache.org/projects/flink/flink-docs-release-1.10/api/java/org/apache/flink/streaming/api/functions/windowing/ProcessWindowFunction.html]
>
> [clear|https://ci.apache.org/projects/flink/flink-docs-release-1.10/api/java/org/apache/flink/streaming/api/functions/windowing/ProcessWindowFunction.html#clear-org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction.Context-]
> method says
> {quote}Deletes any state in the Context when the Window is purged.
> {quote}
> But, this is not true anymore. This behavior was changed in FLINK-4994.
> Before FLINK-4994, when Trigger.PURGE was called, it would invoke
> ProcessWindowFunction's clear( ) method to clean up all keyed per-window
> state.
> But after FLINK-4994, ProcessWindowFunction's clear is called only when the
> window expires, which is to say the window reaches its
> [window.maxTimestamp|https://ci.apache.org/projects/flink/flink-docs-release-1.10/api/java/org/apache/flink/streaming/api/windowing/windows/Window.html#maxTimestamp--].
> This change in behavior comes from
> [this|https://github.com/apache/flink/commit/0b331a421267a541d91e94f2713534704ed32bed#diff-408a499e1a35840c52e29b7ccab866b1R461-R464]
> code change (repeated in a few other places) in FLINK-4994.
> +*Proposed change:*+
> I think we should change the description to say
> {quote}Deletes any state in the Context when the Window expires (reaches its
> [maxTimestamp|https://ci.apache.org/projects/flink/flink-docs-release-1.10/api/java/org/apache/flink/streaming/api/windowing/windows/Window.html#maxTimestamp--]).
> {quote}
> +*Why this can be helpful:*+
> The current documentation could be misleading. Developers will assume that
> the _keyed per-window state_ will get cleared when a PURGE executes. But that
> won't happen. I myself had to go through flink source code to identify the
> disconnect. Updating the javadoc can help future users to avoid such
> confusions.
> +*Links to lines of code that will need updating:*+
> #
> [ProcessWindowFunction.scala|https://github.com/apache/flink/blob/8674b69964eae50cad024f2c5caf92a71bf21a09/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessWindowFunction.scala#L54]
> #
> [ProcessAllWindowFunction.scala|https://github.com/apache/flink/blob/8674b69964eae50cad024f2c5caf92a71bf21a09/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessAllWindowFunction.scala#L51]
> #
> [ProcessWindowFunction.java|https://github.com/apache/flink/blob/8674b69964eae50cad024f2c5caf92a71bf21a09/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessWindowFunction.java#L55]
> #
> [ProcessAllWindowFunction.java|https://github.com/apache/flink/blob/8674b69964eae50cad024f2c5caf92a71bf21a09/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessAllWindowFunction.java#L53]
> #
> [InternalWindowFunction.java|https://github.com/apache/flink/blob/8674b69964eae50cad024f2c5caf92a71bf21a09/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalWindowFunction.java#L47]
>
> I have a PR ready, which I can put out once the ticket is approved / assigned.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)