Table of Contents

Class TumblingWindowExtensions

Namespace
Scaleout.Streaming.TimeWindowing.Linq
Assembly
Scaleout.Streaming.TimeWindowing.dll

Provides extension method for tumbling window transformation of a collection.

public static class TumblingWindowExtensions
Inheritance
TumblingWindowExtensions
Inherited Members

Methods

ToTumblingWindows<TSource>(IEnumerable<TSource>, Func<TSource, DateTime>, DateTime, DateTime, TimeSpan)

Transforms a collection into an enumerable collection of fixed-time windows. The source collection must be sorted chronologically.

public static IEnumerable<ITimeWindow<TSource>> ToTumblingWindows<TSource>(this IEnumerable<TSource> source, Func<TSource, DateTime> timestampSelector, DateTime startTime, DateTime endTime, TimeSpan windowDuration)

Parameters

source IEnumerable<TSource>

The sequence of elements to transform.

timestampSelector Func<TSource, DateTime>

A function to extract a timestamp from an element.

startTime DateTime

Start time (inclusive) of the first window.

endTime DateTime

End time (exclusive) for the last window.

windowDuration TimeSpan

Duration of each time window. This is a maximum value that may be shortened for the last window in the returned sequence (see remarks).

Returns

IEnumerable<ITimeWindow<TSource>>

An enumerable set of ITimeWindow<TElement> collections.

Type Parameters

TSource

The type of objects in the source collection.

Remarks

The method returns a sequence of ITimeWindow<TElement> elements, where each window is an enumerable collection of elements from the source collection whose timestamp falls within its specified range. The StartTime is inclusive and the EndTime is exclusive.

The last window returned by this method may have a shorter duration than what is specified by the windowDuration argument. This happens when the duration would cause the window to extend beyond the specified endTime.