esper
esper copied to clipboard
prepared statement alters pattern definition
I have the following prepared statement:
select * from pattern [every a=A -> (timer:at(?, *, *, *, 1:5) and not A)]
Once it is deployed its definition is changed to the following
select * from pattern [every a=A -> timer:at(?, *, *, *, 1:5) and not A]
Since the brackets have been removed it now has a different semantic.
see test class below:
public static void main(String[] args) throws InterruptedException {
Configuration config = new Configuration();
config.addEventType(A.class);
EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);
String epl = "select * from pattern [every a=A -> (timer:at(?, *, *, *, 1:5) and not A)]";
EPPreparedStatement prepared = epService.getEPAdministrator().prepareEPL(epl);
prepared.setObject(1, 0);
EPStatementImpl statement = (EPStatementImpl) epService.getEPAdministrator().create(prepared);
String newEpl = statement.getStatementContext().getEpStatementHandle().getEPL();
System.out.println(newEpl);
epService.getEPRuntime().sendEvent(new A());
epService.destroy();
}
public static class A {
}
"->" has the lowest precedence so it is the same with or without paren.
I see, thanks