You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "jackylau (Jira)" <ji...@apache.org> on 2020/10/22 01:59:00 UTC

[jira] [Updated] (FLINK-19755) flink cep

     [ https://issues.apache.org/jira/browse/FLINK-19755?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jackylau updated FLINK-19755:
-----------------------------
    Description: 
{code:java}
 symbol   tax   price         rowtime
======== ===== ======= =====================
 XYZ      1     7       2018-09-17 10:00:01
 XYZ      2     9       2018-09-17 10:00:02
 XYZ      1     10      2018-09-17 10:00:03
 XYZ      2     5       2018-09-17 10:00:04
 XYZ      2     17      2018-09-17 10:00:05
 XYZ      2     14      2018-09-17 10:00:06


SELECT *
FROM Ticker
    MATCH_RECOGNIZE(
        PARTITION BY symbol
        ORDER BY rowtime
        MEASURES
            SUM(A.price) AS sumPrice,
            FIRST(rowtime) AS startTime,
            LAST(rowtime) AS endTime
        ONE ROW PER MATCH
        [AFTER MATCH STRATEGY]
        PATTERN (A+ C)
        DEFINE
            A AS SUM(A.price) < 30
    )
 

{code}
{code:java}
AFTER MATCH SKIP TO LAST A 

symbol   sumPrice        startTime              endTime
======== ========== ===================== =====================
 XYZ      26         2018-09-17 10:00:01   2018-09-17 10:00:04
 XYZ      15         2018-09-17 10:00:03   2018-09-17 10:00:05
 XYZ      22         2018-09-17 10:00:04   2018-09-17 10:00:06
 XYZ      17         2018-09-17 10:00:05   2018-09-17 10:00:06

Again, the first result matched against the rows #1, #2, #3, #4.Compared to the previous strategy, the next match includes only row #3 (mapped to A) again for the next matching.

Therefore, the second result matched against the rows #3, #4, #5.

The third result matched against the rows #4, #5, #6.

The last result matched against the rows #5, #6.{code}
h5. i think it will exist looping match when coming to 17, 14 using "AFTER MATCH SKIP TO LAST A "

  was:
{code:java}
 symbol   tax   price         rowtime
======== ===== ======= =====================
 XYZ      1     7       2018-09-17 10:00:01
 XYZ      2     9       2018-09-17 10:00:02
 XYZ      1     10      2018-09-17 10:00:03
 XYZ      2     5       2018-09-17 10:00:04
 XYZ      2     17      2018-09-17 10:00:05
 XYZ      2     14      2018-09-17 10:00:06


SELECT *
FROM Ticker
    MATCH_RECOGNIZE(
        PARTITION BY symbol
        ORDER BY rowtime
        MEASURES
            SUM(A.price) AS sumPrice,
            FIRST(rowtime) AS startTime,
            LAST(rowtime) AS endTime
        ONE ROW PER MATCH
        [AFTER MATCH STRATEGY]
        PATTERN (A+ C)
        DEFINE
            A AS SUM(A.price) < 30
    )
 

{code}
h5. {{}}
{code:java}
AFTER MATCH SKIP TO LAST A 

symbol   sumPrice        startTime              endTime
======== ========== ===================== =====================
 XYZ      26         2018-09-17 10:00:01   2018-09-17 10:00:04
 XYZ      15         2018-09-17 10:00:03   2018-09-17 10:00:05
 XYZ      22         2018-09-17 10:00:04   2018-09-17 10:00:06
 XYZ      17         2018-09-17 10:00:05   2018-09-17 10:00:06

Again, the first result matched against the rows #1, #2, #3, #4.Compared to the previous strategy, the next match includes only row #3 (mapped to A) again for the next matching.

Therefore, the second result matched against the rows #3, #4, #5.

The third result matched against the rows #4, #5, #6.

The last result matched against the rows #5, #6.{code}
h5. {{}}
h5. {{}}


> flink cep 
> ----------
>
>                 Key: FLINK-19755
>                 URL: https://issues.apache.org/jira/browse/FLINK-19755
>             Project: Flink
>          Issue Type: Bug
>          Components: Library / CEP
>    Affects Versions: 1.11.0
>         Environment: I think it will exist looping match when coming to 17, 14 using AFTER MATCH SKIP TO LAST A 
>            Reporter: jackylau
>            Priority: Major
>             Fix For: 1.12.0
>
>
> {code:java}
>  symbol   tax   price         rowtime
> ======== ===== ======= =====================
>  XYZ      1     7       2018-09-17 10:00:01
>  XYZ      2     9       2018-09-17 10:00:02
>  XYZ      1     10      2018-09-17 10:00:03
>  XYZ      2     5       2018-09-17 10:00:04
>  XYZ      2     17      2018-09-17 10:00:05
>  XYZ      2     14      2018-09-17 10:00:06
> SELECT *
> FROM Ticker
>     MATCH_RECOGNIZE(
>         PARTITION BY symbol
>         ORDER BY rowtime
>         MEASURES
>             SUM(A.price) AS sumPrice,
>             FIRST(rowtime) AS startTime,
>             LAST(rowtime) AS endTime
>         ONE ROW PER MATCH
>         [AFTER MATCH STRATEGY]
>         PATTERN (A+ C)
>         DEFINE
>             A AS SUM(A.price) < 30
>     )
>  
> {code}
> {code:java}
> AFTER MATCH SKIP TO LAST A 
> symbol   sumPrice        startTime              endTime
> ======== ========== ===================== =====================
>  XYZ      26         2018-09-17 10:00:01   2018-09-17 10:00:04
>  XYZ      15         2018-09-17 10:00:03   2018-09-17 10:00:05
>  XYZ      22         2018-09-17 10:00:04   2018-09-17 10:00:06
>  XYZ      17         2018-09-17 10:00:05   2018-09-17 10:00:06
> Again, the first result matched against the rows #1, #2, #3, #4.Compared to the previous strategy, the next match includes only row #3 (mapped to A) again for the next matching.
> Therefore, the second result matched against the rows #3, #4, #5.
> The third result matched against the rows #4, #5, #6.
> The last result matched against the rows #5, #6.{code}
> h5. i think it will exist looping match when coming to 17, 14 using "AFTER MATCH SKIP TO LAST A "



--
This message was sent by Atlassian Jira
(v8.3.4#803005)