How to get the last value in a TumblingWindow

Category: sql server streaminsight


yysr on Sun, 07 Apr 2013 12:34:08

Instead of calculating the average or sum or count of a window, 

how do we get the first or last value of a window?


DevBiker on Mon, 08 Apr 2013 16:19:44

Time-Sensitive UDA ... order and select by the payload start time.

See for the docs.

yysr on Wed, 10 Apr 2013 14:55:09

Thank you DevBiker.

Defined an UDA which works fine with TumblingWindow.

However, I got an run-time error for snapshot window.

How do you define LINQ to get the startTime and endTime of snapshot window?

DevBiker on Tue, 16 Apr 2013 16:10:02

The start and end times of the windows are part of the header; you'll get that in your sink.

And, since a snapshot is created whenever you have a new event in the grouping, it doesn't usually make sense. You can use the FoldPairs pattern to compare two consecutive values - you don't need to do anything fancy for that.