【发布时间】:2021-11-08 21:02:50
【问题描述】:
我实现了一个查询,我从数据库中挖掘数据,但我必须更改它,所以我从我的代码中的自定义函数中挖掘我的数据。我阅读了文档并在配置中添加了注释导入。查询抛出该错误:
Failed to resolve event type, named window or table by name 'path.to.my.class.customfunction'
我不知道我的函数必须返回的类型,但我尝试了 Arraylist 和 Hashmaps,键为整数,值为自定义类,但没有成功。
我的最终查询希望如下所示:
select * from LocationEvent as loc,
***CustomFuntion()*** as product
where loc.id=product.id ;
我保留了用于数据库连接的结构。我不知道是否有其他方法可以解决这个问题。谢谢。
编辑:我设法使用该查询调用自定义函数:
select path.to.class.getProducts() as product from pattern[every timer:interval(3 sec)]
我的函数现在返回一个 ArrayList,查询返回这个:
[Product{ProductID=124,.....,},Product{...}]
所以现在我的问题是我无法在查询中访问 Product 的属性,例如 products.ProductID
【问题讨论】:
标签: java complex-event-processing esper