xiaoran created FLINK-33428:
-------------------------------
Summary: Flink sql cep support 'followed','notNext' and
'notFollowedBy' semantics
Key: FLINK-33428
URL: https://issues.apache.org/jira/browse/FLINK-33428
Project: Flink
Issue Type: New Feature
Components: Table SQL / API, Table SQL / Planner
Affects Versions: 1.16.0
Reporter: xiaoran
Currently, the cep mode of the Flink API can support next, notNext, followedBy,
followedByAny, and notFollowedBy semantics, but Flink SQL only supports next
semantics. The remaining notNext and followedBy semantics are implemented by
other alternatives, while the notFollowedBy semantics are not currently
implemented. At present, this semantics is generally implemented in business
scenarios, such as judging that a user has placed an order within 15 minutes
without paying. Therefore, I suggest to provide new functionality to support
notFollowedBy in sql mode, along with the other three semantics
The syntax of enhanced MATCH_RECOGNIZE is proposed as follows:
MATCH_RECOGNIZE (
[ PARTITION BY <expr> [, ... ] ]
[ ORDER BY <expr> [, ... ] ]
[ MEASURES <expr> [AS] <alias> [, ... ] ]
[ ONE ROW PER MATCH [ { SHOW TIMEOUT MATCHES } ] |
ALL ROWS PER MATCH [ { SHOW TIMEOUT MATCHES } ]
]
[ AFTER MATCH SKIP
{
PAST LAST ROW |
TO NEXT ROW |
TO [ { FIRST | LAST} ] <symbol>
}
]
PATTERN ( <pattern> )
DEFINE <symbol> AS <expr> [, ... ]
)
[^ <symbol>] is proposed in <pattern> to express the notNext semantic. For
example, A [^B] is translated to A.notNext(B).
{- <symbol> -} is proposed in <pattern> to express the followedBy semantic. For
example, A { B*? -} C is translated to A.followedBy(C).
{- symbol1 -} with [^ <symbol2>] is proposed in <pattern> to express the
notFollowedBy semantic. For example, A {- B*? -} [^C] is translated to
A.notFollwedBy(B).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)