haoch / flink-siddhi

A CEP library to run Siddhi within Apache Flink™ Streaming Application (Not maintained)
Apache License 2.0
243 stars 96 forks source link

Adding support to preserve annotations at stream and app level. #39

Open Dr0na opened 5 years ago

Dr0na commented 5 years ago

Currently, the query is simply appended to stream definitions. If the query has annotations then the query becomes invalid. Hence the fix. If someone wants to enable statistics for a query, s/he has to add an app level annotation @app:statistics(reporter = 'console') before the query. However, this is currently not supported as the query is directly appended to the stream definitions misplacing the annotation and renders the query invalid. The fix is to insert the stream definitions just before the query. Below is the sample siddhi query with annotations which can be used for testing the fix.

@app:statistics(reporter = 'console') @query(name = 'echo') from inputStream select * insert into outputStream

haoch commented 5 years ago

@Dr0na Thanks for your contribution!

A few comments:

  1. Could you please add some test for the change?
  2. Could you use SiddhiParser to parse the executionPlan to get the annotation of @app and @info instead of parsing string directly?
haoch commented 4 years ago

@Dr0na How do you think about my comments above?