Search code examples
esper

Esper arithmetic operation on date object


I'm looking for a way to determine the time difference between two consecutive events that have a time event property with values like: 2016-08-25T13:05:06.953391Z. What would be the best approach here and what type do I need to use for the event schema. When using Esper EPL online I have tried to use Long or Date but then I get the following error:

Please check the EPL Module Text

Deployment failed in expression 'create schema StockTick(symbol string, price doubl...(63 chars)' : Error starting statement: Nestable type configuration encountered an unexpected property type name 'date' for property 'time', expected java.lang.Class or java.util.Map or the name of a previously-declared Map or ObjectArray type [create schema StockTick(symbol string, price double, time date)]

OR

Please check the Advance Time and Send Events text

Instruction at line 1 invalid event: Property by name 'time' cannot accept the assigned value: Invalid assignment of column 'time' of type 'java.lang.String' to event property 'time' typed as 'java.lang.Long', column and parameter types mismatch


Solution

  • For the EPL online tool web application, I don't think there is support for parsing custom date format. You can go with "long" and use the millisecond since 00:00:00 UTC on 1 January 1970.