我正在尝试扩展where
枚举方法的Esper文档中的示例,并遇到问题。以下是有问题的例子:
select items.where(i => i.location.x = 0 and i.location.y = 0) as zeroloc
from LocationReport
我想做的事情似乎很简单。而不是选择与此表达式匹配的items
:
我想选择包含与表达式匹配的至少一个LocationReport
的{{1}}个。
在time_batch窗口上执行此操作(强调文本非批量时间窗口也是可能的。)
因此,每隔 n 秒,我会收到item
个集合,其中每个报告的项目列表中至少包含一个零位置。
For Reference,以下是Esper示例中使用的Java对象的结构:
public class LocationReport {List items; ...
public class Item {String assetId; //乘客或行李资产 id位置位置; //(x,y)location boolean luggage; // 如果此项目是行李件,则为true StringIndPassenger; //如果 该项目是行李,包含乘客相关...
public class Location {int x; int y; ...
背景细节:假设LocationReport
是我感兴趣的实际对象...
使用上面示例中的EPL,LocationReport
逻辑工作,但问题是,在仅返回where
成员时,我看不到它来自的items
类,其中包含LocationReport
以外的其他属性items
需要。
另外,可能不相关,但在我的情况下,我收到很高的消息率,其中许多LocationReports是重复的(或者足够接近被认为是重复的),而我的where子句需要做出这个决定并且只能转发“新”消息。
谢谢!
答案 0 :(得分:1)
您可以添加" *"选择,并给你事件对象。 select *, items.where(...) from LocationReport
您可以每隔N秒添加"输出"输出。添加" #time(...)"对于时间窗口。