manner commented on code in PR #30256:
URL: https://github.com/apache/flink/pull/30256#discussion_r4786478956


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecMatch.java:
##########
@@ -433,6 +434,17 @@ private Pattern<RowData, RowData> applyQuantifier(
                 Pattern<RowData, RowData> pattern, int startNum, int endNum, 
boolean greedy) {
             boolean isOptional = startNum == 0 && endNum == 1;
 
+            // CEP's optional(), used for ? and *, rejects a greedy previous 
pattern
+            if (startNum == 0
+                    && (endNum == 1 || endNum == -1)
+                    && pattern.getPrevious() != null
+                    && pattern.getPrevious()
+                            .getQuantifier()
+                            
.hasProperty(Quantifier.QuantifierProperty.GREEDY)) {
+                throw new ValidationException(
+                        "An optional pattern variable is not allowed directly 
after a greedy pattern variable.");

Review Comment:
   Should we maybe say it's not supported instead of not allowed? Optional 
after greedy works in other engines (tried locally with Trino), it's just not 
supported in Flink (yet?).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to