SQL Server 2008 R2: StreamInsight - User-defined aggregates

Posted by Greg Low on SQL Blog See other posts from SQL Blog or by Greg Low
Published on Sat, 08 May 2010 05:02:00 GMT Indexed on 2010/05/08 5:30 UTC
Read the original article Hit count: 328

Filed under:
I'd briefly played around with user-defined aggregates in StreamInsight with CTP3 but when I started working with the new Count Windows, I found I had to have one working. I learned a few things along the way that I hope will help someone. The first thing you have to do is define a class: public class IntegerAverage : CepAggregate < int , int > { public override int GenerateOutput( IEnumerable < int > eventData) { if (eventData.Count() == 0) { return 0; } else { return eventData.Sum()...(read more)

© SQL Blog or respective owner