Streaminsight window: Basic knowledge

Source: Internet
Author: User

Link: http://blogs.msdn.com/ B /streaminsight/archive/2010/11/23/windows-part-1-the-basics.aspx

Original Author: Roman schindlauer-Senior Program Manager of streaminsight, whose boss is Torsten grabs mentioned in the previous blog.

If you begin to learn how to write streaminsight queries, the first concept most likely to come across is windows ). In this blog post, we will introduce how to use the window, hoping to help readers better understand some of the advantages and restrictions of using the window. Haha, the window here is not Microsoft Windows.

In the event processing world, a window is used to define a set, and these sets will become the objects of some set operations. These operations may be:

  • Aggregate operations for calculating a single result, such as sum, Count, Min, Max, or custom aggregate operations;
  • Return multiple form-based operation results, such as the topk or user-defined operators.

The streaminsight window splits the timeline into fragments.

The length of the streaminsight window can be a fixed time span (HOP window hoppingwindow and tumblingwindow), or it can be determined by the event itself (count window countingwindow and snapshot window snapshotwindow ). Is an example of a "window", where "sum" is used in some load domains:

Window and set operations often need to be put together for operations. A Window integrating set operations can be seen as a "Building Block" in streaminsight queries ". The following describes how to construct a query with a set operation and a window using LINQ:

var result = from window in input                 .TumblingWindow(TimeSpan.FromMinutes(5),                                 HoppingWindowOutputPolicy.ClipToWindowEnd)             select new { sum = window.Sum(e => e.Value) };

The components that combine window and set operations above this class accept cepstream and generate cepstream. First, the window Extension function returns cepwindowstream, and then applies the set operation on it. Next we will write another blog post to discuss these specific window types.

Sometimes, when you think of a window as just "a collection of events in the memory", you will be asked about how to "access" the window in different ways. Indeed, a window is a collection of events in streaminsight's controllable memory and can be accessed programmatically: User-defined aggregate operations (Udas) or user-defined operators (udos ). These extended interfaces allow you to write C # code to operate events in the window, such as generating a single aggregation result (using UDA) or generate one or more complete events (using UDO ). These are provided as subtypes in the streaminsight API. The best thing about these interfaces is that although they introduce imperative programming in the streaminsight event processing stream, they also support declarative models: accept event sets (Windows) and outputs some results accordingly. In this process, you do not need to worry about the order in which UDA or Udo will be called at runtime. In addition, because the input event set in this interface is ienumerable, we can also compile the LINQ to objects on it!

This may sound tempting for developers who have not yet played an advanced Declarative Programming Model (for example, writing UDA/Udo with LINQ, however, we recommend that you first use the built-in streaminsight operator to write some queries to familiarize yourself with the runtime of streaminsight.

 

In this case,

Roman

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.