我有此代码:
@Name("Creating_hourly_measurement_Position_Stopper for line 2")
insert into CreateMeasurement
select
m.measurement.source as source,
current_timestamp().toDate() as time,
"Line2_Count_Position_Stopper_Measurement" as type,
{
"Line2_DoughDeposit2.Hourly_Count_Position_Stopper.value",
count(cast(getNumber(m, "Status.Sidestopper_positioning.value"), double)),
"Line2_DoughDeposit2.Hourly_Count_Position_Stopper.unit",
getString(m, "Status.Sidestopper_positioning.unit")
} as fragments
from MeasurementCreated.win:time(1 hours) m
where getNumber(m, "Status.Sidestopper_positioning.value") is not null
and cast(getNumber(m, "Status.Sidestopper_positioning.value"), int) = 1
and m.measurement.source.value = "903791"
output last every 1 hours;
但是似乎循环了。我相信这是因为新的衡量标准将修改此组,这意味着它正在不断扩展。这意味着,每当有新数据可用时,都将执行重新计算。
是否有一种方法可以每小时或每天对测量进行计数或获得测量的总数?
答案 0 :(得分:0)
它消耗的流是“ MeasurementCreated”(请参阅),它不是任何EPL产生的,因此可以放心地说,这个EPL本身不可能循环。
如果您想改善EPL,请在此链接中找到一些信息:http://esper.espertech.com/release-8.2.0/reference-esper/html_single/index.html#processingmodel_basicfilter 通过将子句文本移到过滤器中,您可以及早丢弃事件。
答案 1 :(得分:0)
插入到CreateMeasurement中,然后在MeasurementCreated中引起事件吗?