You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2017/10/13 22:34:23 UTC

[1/2] flink git commit: [hotfix] [docs] Remove weasel words, fix passive voice, typos and formatting

Repository: flink
Updated Branches:
  refs/heads/master 90be5774e -> a3d9db25b


[hotfix] [docs] Remove weasel words, fix passive voice, typos and formatting

This closes #4816


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a3d9db25
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a3d9db25
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a3d9db25

Branch: refs/heads/master
Commit: a3d9db25b93a6028f093fa076809011c06eca2d5
Parents: 47282af
Author: Chris Ward <ch...@gmail.com>
Authored: Thu Oct 12 15:51:44 2017 +0200
Committer: Stephan Ewen <se...@apache.org>
Committed: Fri Oct 13 21:07:08 2017 +0200

----------------------------------------------------------------------
 docs/dev/libs/cep.md | 144 +++++++++++++++++++---------------------------
 1 file changed, 58 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/a3d9db25/docs/dev/libs/cep.md
----------------------------------------------------------------------
diff --git a/docs/dev/libs/cep.md b/docs/dev/libs/cep.md
index 0373155..506ddfe 100644
--- a/docs/dev/libs/cep.md
+++ b/docs/dev/libs/cep.md
@@ -24,13 +24,12 @@ under the License.
 -->
 
 FlinkCEP is the Complex Event Processing (CEP) library implemented on top of Flink.
-It allows you to easily detect event patterns in an endless stream of events, thus
-giving you the opportunity to quickly get hold of what's really important in your
+It allows you to detect event patterns in an endless stream of events, giving you the opportunity to get hold of what's important in your
 data.
 
 This page describes the API calls available in Flink CEP. We start by presenting the [Pattern API](#the-pattern-api),
 which allows you to specify the patterns that you want to detect in your stream, before presenting how you can
-[detect and act upon matching event sequences](#detecting-patterns). At the end, we present the assumptions the CEP
+[detect and act upon matching event sequences](#detecting-patterns). We then present the assumptions the CEP
 library makes when [dealing with lateness](#handling-lateness-in-event-time) in event time and how you can
 [migrate your job](#migrating-from-an-older-flink-version) from an older Flink version to Flink-1.3.
 
@@ -39,7 +38,7 @@ library makes when [dealing with lateness](#handling-lateness-in-event-time) in
 
 ## Getting Started
 
-If you want to jump right in, you have to [set up a Flink program]({{ site.baseurl }}/dev/linking_with_flink.html) and
+If you want to jump right in, [set up a Flink program]({{ site.baseurl }}/dev/linking_with_flink.html) and
 add the FlinkCEP dependency to the `pom.xml` of your project.
 
 <div class="codetabs" markdown="1">
@@ -64,14 +63,13 @@ add the FlinkCEP dependency to the `pom.xml` of your project.
 </div>
 </div>
 
-Note that FlinkCEP is currently not part of the binary distribution.
-See linking with it for cluster execution [here]({{site.baseurl}}/dev/linking.html).
+{% info %} FlinkCEP is not part of the binary distribution. See how to link with it for cluster execution [here]({{site.baseurl}}/dev/linking.html).
 
 Now you can start writing your first CEP program using the Pattern API.
 
 {% warn Attention %} The events in the `DataStream` to which
 you want to apply pattern matching must implement proper `equals()` and `hashCode()` methods
-because these are used for comparing and matching events.
+because FlinkCEP uses them for comparing and matching events.
 
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
@@ -130,41 +128,33 @@ val result: DataStream[Alert] = patternStream.select(createAlert(_))
 
 ## The Pattern API
 
-The pattern API allows you to quickly define complex pattern sequences that you want to extract
-from your input stream.
+The pattern API allows you to define complex pattern sequences that you want to extract from your input stream.
 
-Each such complex pattern sequence consists of multiple simple patterns, i.e. patterns looking for
-individual events with the same properties. From now on, these simple patterns will be called **patterns**, and
-the final complex pattern sequence we are searching for in the stream, the **pattern sequence**. A pattern sequence
-can be seen as a graph of such patterns, where transitions from one pattern to the next occur based on user-specified
+Each complex pattern sequence consists of multiple simple patterns, i.e. patterns looking for individual events with the same properties. From now on, we will call these simple patterns **patterns**, and the final complex pattern sequence we are searching for in the stream, the **pattern sequence**. You can see a pattern sequence as a graph of such patterns, where transitions from one pattern to the next occur based on user-specified
 *conditions*, e.g. `event.getName().equals("start")`. A **match** is a sequence of input events which visits all
 patterns of the complex pattern graph, through a sequence of valid pattern transitions.
 
-{% warn Attention %} Each pattern must have a unique name, which is used to later
-identify the matched events.
+{% warn Attention %} Each pattern must have a unique name, which you use later to identify the matched events.
 
 {% warn Attention %} Pattern names **CANNOT** contain the character `":"`.
 
-In the remainder of this section we will first describe how to define [Individual Patterns](#individual-patterns), and then cover how you can
-combine individual patterns into [Complex Patterns](#combining-patterns).
+In the rest of this section we will first describe how to define [Individual Patterns](#individual-patterns), and then how you can combine individual patterns into [Complex Patterns](#combining-patterns).
 
 ### Individual Patterns
 
-A **Pattern** can be either a *singleton* pattern, or a *looping* one. Singleton patterns accept a single
-event, while looping ones can accept more than one. In pattern matching symbols, in the pattern `"a b+ c? d"` (or `"a"`,
-followed by *one or more* `"b"`'s, optionally followed by a `"c"`, followed by a `"d"`), `a`, `c?`, and `d` are
+A **Pattern** can be either a *singleton* or a *looping* pattern. Singleton patterns accept a single
+event, while looping patterns can accept more than one. In pattern matching symbols, the pattern `"a b+ c? d"` (or `"a"`, followed by *one or more* `"b"`'s, optionally followed by a `"c"`, followed by a `"d"`), `a`, `c?`, and `d` are
 singleton patterns, while `b+` is a looping one. By default, a pattern is a singleton pattern and you can transform
-it to a looping one by using [Quantifiers](#quantifiers). In addition, each pattern can have one or more
+it to a looping one by using [Quantifiers](#quantifiers). Each pattern can have one or more
 [Conditions](#conditions) based on which it accepts events.
 
 #### Quantifiers
 
-In FlinkCEP, looping patterns can be specified using these methods: `pattern.oneOrMore()`, for patterns that expect one or
-more occurrences of a given event (e.g. the `b+` mentioned previously); and `pattern.times(#ofTimes)`, for patterns that
-expect a specific number of occurrences of a given type of event, e.g. 4 `a`'s; and `pattern.times(#fromTimes, #toTimes)`,
-for patterns that expect a specific minimum number of occurrences and maximum number of occurrences of a given type of event,
-e.g. 2-4 `a`s. Looping patterns can be made greedy using the `pattern.greedy()` method and group pattern cannot be made greedy
-currently. All patterns, looping or not, can be made optional using the `pattern.optional()` method.
+In FlinkCEP, you can specifiy looping patterns using these methods: `pattern.oneOrMore()`, for patterns that expect one or more occurrences of a given event (e.g. the `b+` mentioned before); and `pattern.times(#ofTimes)`, for patterns that
+expect a specific number of occurrences of a given type of event, e.g. 4 `a`'s; and `pattern.times(#fromTimes, #toTimes)`, for patterns that expect a specific minimum number of occurrences and a maximum number of occurrences of a given type of event, e.g. 2-4 `a`s.
+
+You can make looping patterns greedy using the `pattern.greedy()` method, but you cannot yet make group patterns greedy. You can make all patterns, looping or not, optional using the `pattern.optional()` method.
+
 For a pattern named `start`, the following are valid quantifiers:
 
  <div class="codetabs" markdown="1">
@@ -260,13 +250,13 @@ For a pattern named `start`, the following are valid quantifiers:
 
 #### Conditions
 
-At every pattern, and in order to go from one pattern to the next, you can specify additional **conditions**.
-These conditions can be related to:
+At every pattern, and to go from one pattern to the next, you can specify additional **conditions**.
+You can relate these conditions to:
 
- 1. a [property of the incoming event](#conditions-on-properties), e.g. its value should be larger than 5,
+ 1. A [property of the incoming event](#conditions-on-properties), e.g. its value should be larger than 5,
  or larger than the average value of the previously accepted events.
 
- 2. the [contiguity of the matching events](#conditions-on-contiguity), e.g. detect pattern `a,b,c` without
+ 2. The [contiguity of the matching events](#conditions-on-contiguity), e.g. detect pattern `a,b,c` without
  non-matching events between any matching ones.
 
 The latter refers to "looping" patterns, *i.e.* patterns that can accept more than one event, e.g. the `b+` in `a b+ c`,
@@ -274,16 +264,13 @@ which searches for one or more `b`'s.
 
 ##### Conditions on Properties
 
-Conditions on the event properties can be specified via the `pattern.where()`, `pattern.or()` or the `pattern.until()` method. These can
-be either `IterativeCondition`s or `SimpleCondition`s.
+You can specify conditions on the event properties via the `pattern.where()`, `pattern.or()` or the `pattern.until()` method. These can be either `IterativeCondition`s or `SimpleCondition`s.
 
-**Iterative Conditions:** This is the most general type of conditions. This is how you can specify a condition that
-accepts subsequent events based on properties of the previously accepted events or some statistic over a subset of them.
+**Iterative Conditions:** This is the most general type of condition. This is how you can specify a condition that
+accepts subsequent events based on properties of the previously accepted events or a statistic over a subset of them.
 
 Below is the code for an iterative condition that accepts the next event for a pattern named "middle" if its name starts
-with "foo", and if the sum of the prices of the previously accepted events for that pattern plus the price of the current
-event do not exceed the value of 5.0. Iterative conditions can be very powerful, especially in combination with looping
-patterns, e.g. `oneOrMore()`.
+with "foo", and if the sum of the prices of the previously accepted events for that pattern plus the price of the current event do not exceed the value of 5.0. Iterative conditions can be powerful, especially in combination with looping patterns, e.g. `oneOrMore()`.
 
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
@@ -343,7 +330,7 @@ start.where(event => event.getName.startsWith("foo"))
 </div>
 </div>
 
-Finally, we can also restrict the type of the accepted event to some subtype of the initial event type (here `Event`)
+Finally, you can also restrict the type of the accepted event to a subtype of the initial event type (here `Event`)
 via the `pattern.subtype(subClass)` method.
 
 <div class="codetabs" markdown="1">
@@ -365,10 +352,7 @@ start.subtype(classOf[SubEvent]).where(subEvent => ... /* some condition */)
 </div>
 </div>
 
-**Combining Conditions:** As shown, the `subtype` condition can be combined with additional conditions.
-In fact, this holds for every condition. You can arbitrarily combine conditions by sequentially calling
-`where()`. The final result will be the logical **AND** of the results of the individual conditions. In
-order to combine conditions using **OR**, you can use the `or()` method, as shown below.
+**Combining Conditions:** As shown above, you can combine the `subtype` condition with additional conditions. This holds for every condition. You can arbitrarily combine conditions by sequentially calling `where()`. The final result will be the logical **AND** of the results of the individual conditions. To combine conditions using **OR**, you can use the `or()` method, as shown below.
 
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
@@ -412,22 +396,21 @@ As you can see `{a1 a2 a3}` or `{a2 a3}` are not returned due to the stop condit
 
 FlinkCEP supports the following forms of contiguity between events:
 
- 1. Strict Contiguity: which expects all matching events to appear strictly the one after the other,
- without any non-matching events in-between.
+ 1. **Strict Contiguity**: Expects all matching events to appear strictly one after the other, without any non-matching events in-between.
 
- 2. Relaxed Contiguity: which simply ignores non-matching events appearing in-between the matching ones.
+ 2. **Relaxed Contiguity**: Ignores non-matching events appearing in-between the matching ones.
 
- 3. Non-Deterministic Relaxed Contiguity: which further relaxes contiguity, allowing additional matches
+ 3. **Non-Deterministic Relaxed Contiguity**: Further relaxes contiguity, allowing additional matches
  that ignore some matching events.
 
 To illustrate the above with an example, a pattern sequence `"a+ b"` (one or more `"a"`'s followed by a `"b"`) with
 input `"a1", "c", "a2", "b"` will have the following results:
 
- 1. Strict Contiguity: `{a2 b}` -- the `"c"` after `"a1"` causes `"a1"` to be discarded.
+ 1. **Strict Contiguity**: `{a2 b}` -- the `"c"` after `"a1"` causes `"a1"` to be discarded.
 
- 2. Relaxed Contiguity: `{a1 b}` and `{a1 a2 b}` -- `c` is simply ignored.
+ 2. **Relaxed Contiguity**: `{a1 b}` and `{a1 a2 b}` -- `c` is ignored.
 
- 3. Non-Deterministic Relaxed Contiguity: `{a1 b}`, `{a2 b}`, and `{a1 a2 b}`.
+ 3. **Non-Deterministic Relaxed Contiguity**: `{a1 b}`, `{a2 b}`, and `{a1 a2 b}`.
 
 For looping patterns (e.g. `oneOrMore()` and `times()`) the default is *relaxed contiguity*. If you want
 strict contiguity, you have to explicitly specify it by using the `consecutive()` call, and if you want
@@ -487,7 +470,7 @@ pattern.where(new IterativeCondition<Event>() {
               <tr>
                  <td><strong>until(condition)</strong></td>
                  <td>
-                     <p>Specifies a stop condition for looping pattern. Meaning if event matching the given condition occurs, no more
+                     <p>Specifies a stop condition for a looping pattern. Meaning if event matching the given condition occurs, no more
                      events will be accepted into the pattern.</p>
                      <p>Applicable only in conjunction with <code>oneOrMore()</code></p>
                      <p><b>NOTE:</b> It allows for cleaning state for corresponding pattern on event-based condition.</p>
@@ -820,7 +803,7 @@ Pattern.begin("start").where(_.getName().equals("c"))
 
 ### Combining Patterns
 
-Now that we have seen what an individual pattern can look like, it is time to see how to combine them
+Now that you've seen what an individual pattern can look like, it is time to see how to combine them
 into a full pattern sequence.
 
 A pattern sequence has to start with an initial pattern, as shown below:
@@ -901,23 +884,22 @@ val relaxedNot: Pattern[Event, _] = start.notFollowedBy("not").where(...)
 </div>
 </div>
 
-Bear in mind that relaxed contiguity means that only the first succeeding matching event will be matched, while
+Relaxed contiguity means that only the first succeeding matching event will be matched, while
 with non-deterministic relaxed contiguity, multiple matches will be emitted for the same beginning. As an example,
 a pattern `a b`, given the event sequence `"a", "c", "b1", "b2"`, will give the following results:
 
-1. Strict Contiguity between `a` and `b`: `{}` (no match) -- the `"c"` after `"a"` causes `"a"` to be discarded.
+1. Strict Contiguity between `a` and `b`: `{}` (no match), the `"c"` after `"a"` causes `"a"` to be discarded.
 
-2. Relaxed Contiguity between `a` and `b`: `{a b1}` -- as relaxed continuity is viewed as "skip non-matching events
+2. Relaxed Contiguity between `a` and `b`: `{a b1}`, as relaxed continuity is viewed as "skip non-matching events
 till the next matching one".
 
-3. Non-Deterministic Relaxed Contiguity between `a` and `b`: `{a b1}`, `{a b2}` -- as this is the most general form.
+3. Non-Deterministic Relaxed Contiguity between `a` and `b`: `{a b1}`, `{a b2}`, as this is the most general form.
 
-Finally, it is also possible to define a temporal constraint for the pattern to be valid.
+It's also possible to define a temporal constraint for the pattern to be valid.
 For example, you can define that a pattern should occur within 10 seconds via the `pattern.within()` method.
 Temporal patterns are supported for both [processing and event time]({{site.baseurl}}/dev/event_time.html).
 
-{% warn Attention %} A pattern sequence can only have one temporal constraint. If
-multiple such constraints are defined on different individual patterns, then the smallest one is applied.
+{% warn Attention %} A pattern sequence can only have one temporal constraint. If multiple such constraints are defined on different individual patterns, then the smallest is applied.
 
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
@@ -933,7 +915,7 @@ next.within(Time.seconds(10))
 </div>
 </div>
 
-It is also possible to define a pattern sequence as the condition for `begin`, `followedBy`, `followedByAny` and
+It's also possible to define a pattern sequence as the condition for `begin`, `followedBy`, `followedByAny` and
 `next`. The pattern sequence will be considered as the matching condition logically and a `GroupPattern` will be
 returned and it is possible to apply `oneOrMore()`, `times(#ofTimes)`, `times(#fromTimes, #toTimes)`, `optional()`,
 `consecutive()`, `allowCombinations()` to the `GroupPattern`.
@@ -1252,8 +1234,7 @@ pattern.within(Time.seconds(10))
 
 ### After Match Skip Strategy
 
-For a given pattern, same event may be assigned to multiple successful matches. In order to control to how many matches an event will be assigned, we need to specify the skip strategy called `AfterMatchSkipStrategy`. 
-There're four types of skip strategies, listed as follows:
+For a given pattern, the same event may be assigned to multiple successful matches. To control to how many matches an event will be assigned, you need to specify the skip strategy called `AfterMatchSkipStrategy`. There are four types of skip strategies, listed as follows:
 
 * <strong>*NO_SKIP*</strong>: Every possible match will be emitted.
 * <strong>*SKIP_PAST_LAST_EVENT*</strong>: Discards every partial match that contains event of the match.
@@ -1262,7 +1243,7 @@ There're four types of skip strategies, listed as follows:
 
 Notice that when using *SKIP_TO_FIRST* and *SKIP_TO_LAST* skip strategy, a valid *PatternName* should also be specified.
 
-Let's take an example: For a given pattern `a b{2}` and a data stream `ab1, ab2, ab3, ab4, ab5, ab6`, the differences between these four skip strategies can be listed as follows:
+For example, for a given pattern `a b{2}` and a data stream `ab1, ab2, ab3, ab4, ab5, ab6`, the differences between these four skip strategies are as follows:
 
 <table class="table table-bordered">
     <tr>
@@ -1352,10 +1333,8 @@ Pattern.begin("patternName", skipStrategy)
 ## Detecting Patterns
 
 After specifying the pattern sequence you are looking for, it is time to apply it to your input stream to detect
-potential matches. In order to run a stream of events against your pattern sequence, you have to create a `PatternStream`.
-Given an input stream `input`, a pattern `pattern` and an optional comparator `comparator` which is used to
-sort events with the same timestamp in case of EventTime or that arrived at the same moment, you create the
-`PatternStream` by calling:
+potential matches. To run a stream of events against your pattern sequence, you have to create a `PatternStream`.
+Given an input stream `input`, a pattern `pattern` and an optional comparator `comparator` used to sort events with the same timestamp in case of EventTime or that arrived at the same moment, you create the `PatternStream` by calling:
 
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
@@ -1381,8 +1360,7 @@ val patternStream: PatternStream[Event] = CEP.pattern(input, pattern, comparator
 
 The input stream can be *keyed* or *non-keyed* depending on your use-case.
 
-{% warn Attention %} Applying your pattern on a non-keyed stream will result in a job with
-parallelism equal to 1.
+{% warn Attention %} Applying your pattern on a non-keyed stream will result in a job with parallelism equal to 1.
 
 ### Selecting from Patterns
 
@@ -1395,8 +1373,7 @@ A `PatternSelectFunction` has a `select` method which is called for each matchin
 It receives a match in the form of `Map<String, List<IN>>` where the key is the name of each pattern in your pattern
 sequence and the value is a list of all accepted events for that pattern (`IN` is the type of your input elements).
 The events for a given pattern are ordered by timestamp. The reason for returning a list of accepted events for each
-pattern is that when using looping patterns (e.g. `oneToMany()` and `times()`), more than one event may be accepted for a
-given pattern. The selection function returns exactly one result.
+pattern is that when using looping patterns (e.g. `oneToMany()` and `times()`), more than one event may be accepted for a given pattern. The selection function returns exactly one result.
 
 {% highlight java %}
 class MyPatternSelectFunction<IN, OUT> implements PatternSelectFunction<IN, OUT> {
@@ -1410,7 +1387,7 @@ class MyPatternSelectFunction<IN, OUT> implements PatternSelectFunction<IN, OUT>
 {% endhighlight %}
 
 A `PatternFlatSelectFunction` is similar to the `PatternSelectFunction`, with the only distinction that it can return an
-arbitrary number of results. In order to do this, the `select` method has an additional `Collector` parameter which is
+arbitrary number of results. To do this, the `select` method has an additional `Collector` parameter which is
 used to forward your output elements downstream.
 
 {% highlight java %}
@@ -1432,9 +1409,8 @@ class MyPatternFlatSelectFunction<IN, OUT> implements PatternFlatSelectFunction<
 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 pattern in your pattern
 sequence and the value is an Iterable over all accepted events for that pattern (`IN` is the type of your input elements).
-The events for a given pattern are ordered by timestamp. The reason for returning an iterable of accepted events for each
-pattern is that when using looping patterns (e.g. `oneToMany()` and `times()`), more than one event may be accepted for a
-given pattern. The selection function returns exactly one result per call.
+
+The events for a given pattern are ordered by timestamp. The reason for returning an iterable of accepted events for each pattern is that when using looping patterns (e.g. `oneToMany()` and `times()`), more than one event may be accepted for a given pattern. The selection function returns exactly one result per call.
 
 {% highlight scala %}
 def selectFn(pattern : Map[String, Iterable[IN]]): OUT = {
@@ -1463,12 +1439,12 @@ def flatSelectFn(pattern : Map[String, Iterable[IN]], collector : Collector[OUT]
 ### Handling Timed Out Partial Patterns
 
 Whenever a pattern has a window length attached via the `within` keyword, it is possible that partial event sequences
-are discarded because they exceed the window length. In order to react to these timed out partial matches the `select`
-and `flatSelect` API calls allow a timeout handler to be specified. This timeout handler is called for each timed out
+are discarded because they exceed the window length. To react to these timed out partial matches the `select`
+and `flatSelect` API calls allow you to specify a timeout handler. This timeout handler is called for each timed out
 partial event sequence. The timeout handler receives all the events that have been matched so far by the pattern, and
 the timestamp when the timeout was detected.
 
-In order to treat partial patterns, the `select` and `flatSelect` API calls offer an overloaded version which takes as
+To treat partial patterns, the `select` and `flatSelect` API calls offer an overloaded version which takes as
 parameters
 
  * `PatternTimeoutFunction`/`PatternFlatTimeoutFunction`
@@ -1519,8 +1495,7 @@ val timeoutResult: DataStream<TimeoutEvent> = result.getSideOutput(outputTag);
 ~~~
 
 The `flatSelect` API call offers the same overloaded version which takes as the first parameter a timeout function and as second parameter a selection function.
-In contrast to the `select` functions, the `flatSelect` functions are called with a `Collector`.
-The collector can be used to emit an arbitrary number of events.
+In contrast to the `select` functions, the `flatSelect` functions are called with a `Collector`. You can use the collector to emit an arbitrary number of events.
 
 ~~~scala
 val patternStream: PatternStream[Event] = CEP.pattern(input, pattern)
@@ -1543,21 +1518,18 @@ val timeoutResult: DataStream<TimeoutEvent> = result.getSideOutput(outputTag);
 
 ## Handling Lateness in Event Time
 
-In `CEP` the order in which elements are processed matters. To guarantee that elements are processed in the correct order
-when working in event time, an incoming element is initially put in a buffer where elements are *sorted in ascending
-order based on their timestamp*, and when a watermark arrives, all the elements in this buffer with timestamps smaller
-than that of the watermark are processed. This implies that elements between watermarks are processed in event-time order.
+In `CEP` the order in which elements are processed matters. To guarantee that elements are processed in the correct order when working in event time, an incoming element is initially put in a buffer where elements are *sorted in ascending order based on their timestamp*, and when a watermark arrives, all the elements in this buffer with timestamps smaller than that of the watermark are processed. This implies that elements between watermarks are processed in event-time order.
 
 {% warn Attention %} The library assumes correctness of the watermark when working in event time.
 
-To also guarantee that elements across watermarks are processed in event-time order, Flink's CEP library assumes
+To guarantee that elements across watermarks are processed in event-time order, Flink's CEP library assumes
 *correctness of the watermark*, and considers as *late* elements whose timestamp is smaller than that of the last
 seen watermark. Late elements are not further processed.
 
 ## Examples
 
 The following example detects the pattern `start, middle(name = "error") -> end(name = "critical")` on a keyed data
-stream of `Events`. The events are keyed by their ids and a valid pattern has to occur within 10 seconds.
+stream of `Events`. The events are keyed by their `id`s and a valid pattern has to occur within 10 seconds.
 The whole processing is done with event time.
 
 <div class="codetabs" markdown="1">


[2/2] flink git commit: [FLINK-6615] [core] (followup) Add one more test for FileUtils

Posted by se...@apache.org.
[FLINK-6615] [core] (followup) Add one more test for FileUtils


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/47282af5
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/47282af5
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/47282af5

Branch: refs/heads/master
Commit: 47282af56697aca38a5159044b147bdeaa811a84
Parents: 90be577
Author: Stephan Ewen <se...@apache.org>
Authored: Fri Oct 13 12:15:04 2017 +0200
Committer: Stephan Ewen <se...@apache.org>
Committed: Fri Oct 13 21:07:08 2017 +0200

----------------------------------------------------------------------
 .../org/apache/flink/util/FileUtilsTest.java    | 27 +++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/47282af5/flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java b/flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
index 166d24d..28bb24a 100644
--- a/flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
+++ b/flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
@@ -19,6 +19,7 @@
 package org.apache.flink.util;
 
 import org.apache.flink.core.testutils.CheckedThread;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -27,12 +28,15 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.file.AccessDeniedException;
-import java.nio.file.Files;
-import java.util.Random;
 
-import static org.junit.Assert.*;
-import static org.junit.Assume.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
 
+/**
+ * Tests for the {@link FileUtils}.
+ */
 public class FileUtilsTest {
 
 	@Rule
@@ -101,6 +105,21 @@ public class FileUtilsTest {
 	}
 
 	@Test
+	public void testDeleteDirectoryWhichIsAFile() throws Exception {
+
+		// deleting a directory that is actually a file should fails
+
+		File file = tmp.newFile();
+		try {
+			FileUtils.deleteDirectory(file);
+			fail("this should fail with an exception");
+		}
+		catch (IOException ignored) {
+			// this is what we expect
+		}
+	}
+
+	@Test
 	public void testDeleteDirectoryConcurrently() throws Exception {
 		final File parent = tmp.newFolder();