Github user kl0u commented on a diff in the pull request:
https://github.com/apache/flink/pull/4143#discussion_r123710396
--- Diff:
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java
---
@@ -186,6 +193,24 @@ public Quantifier getQuantifier() {
}
/**
+ * Applies a stop condition for a looping state. It allows cleaning the
underlying state.
+ *
+ * @param untilCondition a condition an event has to satisfy to stop
collecting events into looping state
+ * @return The same pattern with applied untilCondition
+ */
+ public Pattern<T, F> until(IterativeCondition<F> untilCondition) {
+ Preconditions.checkNotNull(untilCondition, "The condition
cannot be null");
+ if
(!quantifier.hasProperty(Quantifier.QuantifierProperty.LOOPING)) {
+ throw new MalformedPatternException("The until
condition is only applicable to looping states.");
+ }
+
--- End diff --
Check also if there is another `until` condition already specified and
throw an exception saying that a condition has already been specified for the
pattern.
---
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.
---