简体   繁体   English

TumblingWindow会在没有事件时开火吗?

[英]Will TumblingWindow fire when there is no event?

StreamInsight TumblingWindow will it fire off if there's no event? 如果没有事件,StreamInsight TumblingWindow会启动吗?

All examples I have seen like the one here, always have an event inside each window: http://sqlblog.com/blogs/stream_insight/archive/2010/12/15/windows-in-streaminsight-hopping-vs-snapshot.aspx 我在这里看到的所有示例都在每个窗口中都有一个事件: http//sqlblog.com/blogs/stream_insight/archive/2010/12/15/windows-in-streaminsight-hopping-vs-snapshot。 ASPX

But the question is when there is no event in a particular window, will it fire off? 但问题是,当特定窗口中没有事件时,它会被触发吗?

If no event fires inside the window then StreamInsight has no idea the window has passed. 如果窗口内没有事件触发,则StreamInsight不知道窗口已经通过。 StreamInsight has no internal "time" so without something "ticking" it would never know a window has passed or not StreamInsight没有内部“时间”,所以没有“滴答作响”的东西,它永远不会知道窗口已经过去了

You could build an observable collection that fires every 1 hour and create 10 minute hopping windows. 您可以构建一个可观察的集合,每1小时触发一次,并创建10分钟的跳跃窗口。 You will not see 6 results. 你不会看到6个结果。

void Main(){

var startTime = DateTime.UtcNow;

//Create an arbitrary number of events.
var source = Application.DefineEnumerable(() => Enumerable.Range(0, 60).Select(i => PointEvent.CreateInsert(startTime.AddHours(i * 1 ), (double)1)));
var input = source.ToStreamable(AdvanceTimeSettings.StrictlyIncreasingStartTime);

//Create a tumbling window that is 10 seconds wide
var query = from i in input.TumblingWindow(TimeSpan.FromSeconds(10))
    select i.Count();

query.Dump();

} }

Snapshot windows are slightly different in that they fire because of events rather than fixed time windows. 快照窗口略有不同,因为事件而不是固定时间窗口。

Does that help. 这有帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM