【发布时间】:2023-03-22 20:41:01
【问题描述】:
我有一系列事件是这样的:
- 事件 A 开始序列
- 多个事件 B 发生
- 事件 C 停止序列
我使用模式 [每个 A -> (B 直到 C)] 做到了这一点,这似乎是正确的(你怎么看?)。但我正在努力从序列中出现的 B 事件中检索和汇总信息。我想简单地计算一下,也许还有一些平均值,但似乎没有任何效果(示例 1 返回 1,示例 2 返回 0,示例 3 返回 null,即使我的 B 事件存在)。
insert into CreateMeasurement
select
C.source as source,
"carDrivingAnalyse" as type,
C.time as time,
{
"example1", count(*),
"example2", count(B),
"example3", B.countOf()
} as fragments
from pattern [
every A = EventCreated(
type = "Ignition",
getString(A, "Ignition.status") = "ON")
-> (
B = EventCreated(
type = "DrivingEvent",
source = A.source,
getString(B, "DrivingEvent.prop1") = getString(A, "Ignition.prop1"),
getNumber(B, "DrivingEvent.prop2") = getNumber(A, "Ignition.prop2"))
until C = EventCreated(
type = "Ignition",
getString(C, "Ignition.status") = "OFF",
source = A.source,
getString(C, "Ignition.prop1") = getString(A, "Ignition.prop1"),
getNumber(C, "Ignition.prop2") = getNumber(A, "Ignition.prop2"))
)
]
【问题讨论】:
标签: aggregate esper cumulocity