Skip to content

Commit

Permalink
[FLINK-7568] Update ProcessFunction.Context in window documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aljoscha committed Sep 5, 2017
1 parent 9fe8f21 commit 006572f
Showing 1 changed file with 53 additions and 10 deletions.
63 changes: 53 additions & 10 deletions docs/dev/stream/operators/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,35 @@ public abstract class ProcessWindowFunction<IN, OUT, KEY, W extends Window> impl
Iterable<IN> elements,
Collector<OUT> out) throws Exception;

/**
* The context holding window metadata
*/
public abstract class Context {
/**
* @return The window that is being evaluated.
*/
public abstract W window();
}
/**
* The context holding window metadata.
*/
public abstract class Context implements java.io.Serializable {
/**
* Returns the window that is being evaluated.
*/
public abstract W window();

/** Returns the current processing time. */
public abstract long currentProcessingTime();

/** Returns the current event-time watermark. */
public abstract long currentWatermark();

/**
* State accessor for per-key and per-window state.
*
* <p><b>NOTE:</b>If you use per-window state you have to ensure that you clean it up
* by implementing {@link ProcessWindowFunction#clear(Context)}.
*/
public abstract KeyedStateStore windowState();

/**
* State accessor for per-key global state.
*/
public abstract KeyedStateStore globalState();
}

}
{% endhighlight %}
</div>
Expand Down Expand Up @@ -528,15 +548,38 @@ abstract class ProcessWindowFunction[IN, OUT, KEY, W <: Window] extends Function
*/
abstract class Context {
/**
* @return The window that is being evaluated.
* Returns the window that is being evaluated.
*/
def window: W

/**
* Returns the current processing time.
*/
def currentProcessingTime: Long

/**
* Returns the current event-time watermark.
*/
def currentWatermark: Long

/**
* State accessor for per-key and per-window state.
*/
def windowState: KeyedStateStore

/**
* State accessor for per-key global state.
*/
def globalState: KeyedStateStore
}

}
{% endhighlight %}
</div>
</div>



A `ProcessWindowFunction` can be defined and used like this:

<div class="codetabs" markdown="1">
Expand Down

0 comments on commit 006572f

Please sign in to comment.