Github user alpinegizmo commented on a diff in the pull request:
https://github.com/apache/flink/pull/4041#discussion_r119886927
--- Diff: docs/dev/libs/cep.md ---
@@ -700,26 +995,29 @@ class MyPatternFlatSelectFunction<IN, OUT> implements
PatternFlatSelectFunction<
</div>
<div data-lang="scala" markdown="1">
-The `select` method takes a selection function as argument, which is
called for each matching event sequence.
-It receives a map of string/event pairs of the matched events.
-The string is defined by the name of the state to which the event has been
matched.
-The selection function returns exactly one result per call.
+The `select()` method takes a selection function as argument, which is
called for each matching event sequence.
+It receives a match in the form of `Map[String, Iterable[IN]]` where the
key is the name of each state in your pattern
+sequence and the value is an Iterable over all accepted events for that
state (`IN` is the type of your input elements).
+The events for a given state are ordered by timestamp. The reason for
returning an iterable of accepted events for each
+state is that when using looping states (e.g. `oneToMany()` and
`times()`), more than one events may be accepted for a
+given state. The selection function returns exactly one result per call.
{% highlight scala %}
-def selectFn(pattern : mutable.Map[String, IN]): OUT = {
- val startEvent = pattern.get("start").get
- val endEvent = pattern.get("end").get
+def selectFn(pattern : Map[String, Iterable[IN]]): OUT = {
+ val startEvent = pattern.get("start").get.next
+ val endEvent = pattern.get("end").get.next
OUT(startEvent, endEvent)
}
{% endhighlight %}
-The `flatSelect` method is similar to the `select` method. Their only
difference is that the function passed to the `flatSelect` method can return an
arbitrary number of results per call.
-In order to do this, the function for `flatSelect` has an additional
`Collector` parameter which is used for the element output.
+The `flatSelect` method is similar to the `select` method. Their only
difference is that the function passed to the
+`flatSelect` method can return an arbitrary number of results per call. In
order to do this, the function for
+`flatSelect` has an additional `Collector` parameter which is used for
forwarding your output elements downstream.
--- End diff --
... which is used to forward ...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---