flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Wysakowicz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-3414) Add Scala API for CEP's pattern definition
Date Mon, 06 Mar 2017 13:36:32 GMT

    [ https://issues.apache.org/jira/browse/FLINK-3414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15897272#comment-15897272
] 

Dawid Wysakowicz commented on FLINK-3414:
-----------------------------------------

Hi [~ivan.mushketyk]

Do you still want to work on it or can I take over?

I really like your proposal for the API. I have some comments though. I would not ommit the
`where` keyword as it makes the code more readable and specify the type in filter. So I would
prefer:

{code}
pattern "start" where is[SubEvent] &&  _.id == 42 -> "next" where is[SubEvent]
&& _.getId() > 42
{code}

rather than

{code}
pattern[SubEvent] "start" _.id == 42 ->[SubEvent] _.getId() > 42
{code}

Also I would stick with the *within* as it betters describes the period.

I like better:
{code}
pattern "start" -> "middle" _.getName() == "error" ->> "end" _.getName() == "critical"
within 10 seconds
{code}


> Add Scala API for CEP's pattern definition
> ------------------------------------------
>
>                 Key: FLINK-3414
>                 URL: https://issues.apache.org/jira/browse/FLINK-3414
>             Project: Flink
>          Issue Type: Improvement
>          Components: CEP
>    Affects Versions: 1.0.0
>            Reporter: Till Rohrmann
>            Assignee: Ivan Mushketyk
>            Priority: Minor
>
> Currently, the CEP library only supports a Java API to specify complex event patterns.
In order to make it a bit less verbose for Scala users, it would be nice to also add a Scala
API for the CEP library. 
> A Scala API would also allow to pass Scala's anonymous functions as filter conditions
or as a select function, for example, or to use partial functions to distinguish between different
events.
> Furthermore, the Scala API could be designed to feel a bit more like a DSL:
> {code}
> begin "start" where _.id >= 42 -> "middle_1" as classOf[Subclass] || "middle_2"
where _.name equals "foobar" -> "end" where x => x.id <= x.volume
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message