ESPER:'分区'CLAUSE ERROR

时间:2015-01-16 22:07:01

标签: complex-event-processing esper

我遇到的问题是使用'分区'在'匹配识别','分区'似乎只支持99个不同的事件,因为当我有100个或更多不同的事件时它不能正确分组。为了测试这个我有以下EPL查询:

select * from TemperatureSensorEvent
match_recognize (
  partition by id
  measures A.id as a_id, A.temperature as a_temperature
  pattern (A)
  define 
    A as prev(A.id) is null
)

我使用此查询基本上是为了获得每个设备的第一个事件(第一个温度),但是使用10,20,50,... 99个不同的设备测试它工作正常但是当我有超过99时,它似乎ESPER重置在id = 100的设备之前发送的所有事件,如果我发送的设备id = 001,则ESPER将其视为第一个事件。

似乎'分区'只支持99个不同的事件,如果再添​​加一个,EPL会重置或类似的事情。这是一个由'划分的限制吗?子句有?,我怎么能增加这个阈值,因为我有超过100个设备?。

ESPER版本:5.1.0

提前致谢

演示班:

public class EsperDemo
{
    public static void main(String[] args)
    {
         Configuration config = new Configuration();
         config.addEventType("TemperatureSensorEvent", TemperatureSensorEvent.class.getName());
         EPServiceProvider esperProvider = EPServiceProviderManager.getProvider("EsperDemoEngine", config);
         EPAdministrator administrator = esperProvider.getEPAdministrator();
         EPRuntime esperRuntime = esperProvider.getEPRuntime();

         // query to get the first event of each temperature sensor
         String query = "select * from TemperatureSensorEvent "
            + "match_recognize ( "
            + "       partition by id "
            + "       measures A.id as a_id, A.temperature as a_temperature "
            + "       after match skip to next row "
            + "       pattern (A) "
            + "       define "
            + "               A as prev(A.id) is null "
            + ")";

         TemperatureSubscriber temperatureSubscriber = new TemperatureSubscriber();

         EPStatement cepStatement = administrator.createEPL(query);
         cepStatement.setSubscriber(temperatureSubscriber);

         TemperatureSensorEvent temperature;
         Random random = new Random();

         int sensorsQuantity = 100;  // it works fine until 99 sensors
         for (int i = 1; i <= sensorsQuantity; i++) {
             temperature = new TemperatureSensorEvent(i, random.nextInt(20));
             System.out.println("Sending temperature: " + temperature.toString());
             esperRuntime.sendEvent(temperature);
         }
         temperature = new TemperatureSensorEvent(1, 64);
         System.out.println("Sending temperature: sensor with id=1 again: " + temperature.toString());
         esperRuntime.sendEvent(temperature);
     }
 }

0 个答案:

没有答案