-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
output first(n) #3
Comments
We'd recommend to write a regression test that tests this example. The regression test will fail, at first, because the EPL grammar need to change. Then go ahead and change the grammar and statement object model and retest. The test should then fail because the new functionality is not implemented yet. We can provide guidance where to implement the new functionality. |
Thanks, yes I will look at the existing test classes (TestOutputLimit*) in src/test/java/com/espertech/esper/regression/view/ and add a similar regression test. |
Initial changes outlined below, please let me know if you have any comments/feedback:
The testcase: (fails without the above changes)
|
Ok that sounds good. The test case seems to no really test much of the new functionality. |
Hi Thomas, yes this was just a first testcase to get started. Will create more coverage as I get to know the esper codebase in more detail. Thanks again for the feedback |
This can be solved with contexts. The issue will be closed unless you think it is still relevant. |
For output suppression Esper allows use of
group by output first every
which gives instant output for the first unique event, and throttles to maximum of 1 every
Issue created to support first(n), to allow more than 1 instant output every
TestEvent with two properties (id1,id2):
== event feed ==
insertEvent A1 = TestEvent("A","1")
incrementTimeBy(1 sec)
insertEvent A2 = TestEvent("A","2")
incrementTimeBy(1 sec)
insertEvent A3 = TestEvent("A","3")
incrementTimeBy(1 sec)
insertEvent B1 = TestEvent("B","1")
incrementTimeBy(1 sec)
insertEvent B2 = TestEvent("B","2")
incrementTimeBy(1 sec)
insertEvent B3 = TestEvent("B","3")
incrementTimeBy(1 hour)
insertEvent A4 = TestEvent("A","4")
incrementTimeBy(1 sec)
insertEvent B4 = TestEvent("B","4")
incrementTimeBy(1 hour)
== event feed end ==
The statement
"select * from TestEvent() group by id1 output first every 1 hour"
results in
== begin ==
TEST_Listener - 0 seconds later, listener called with 1 event(s)
TEST_Listener - * A1
TEST_Listener - 3 seconds later, listener called with 1 event(s)
TEST_Listener - * B1
TEST_Listener - 3605 seconds later, listener called with 1 event(s)
TEST_Listener - * A4
TEST_Listener - 3606 seconds later, listener called with 1 event(s)
TEST_Listener - * B4
== end ==
i.e an instant listener call to the for the first event for each id1 groupby.
Would like to add support for the statement
"select * from TestEvent() group by id1 output first(2) every 1 hour"
which should result in
== begin ==
TEST_Listener - 0 seconds later, listener called with 1 event(s)
TEST_Listener - * A1
TEST_Listener - 1 seconds later, listener called with 1 event(s)
TEST_Listener - * A2
TEST_Listener - 3 seconds later, listener called with 1 event(s)
TEST_Listener - * B1
TEST_Listener - 4 seconds later, listener called with 1 event(s)
TEST_Listener - * B2
TEST_Listener - 3605 seconds later, listener called with 1 event(s)
TEST_Listener - * A4
TEST_Listener - 3606 seconds later, listener called with 1 event(s)
TEST_Listener - * B4
== end ==
The text was updated successfully, but these errors were encountered: