CollectionTRecord, TTimeGroupByTKey, TValue, TOutput Method (ExpressionFuncTRecord, TKey, ExpressionFuncTRecord, TValue, FuncTKey, IEnumerableTValue, IEnumerableTOutput)Naiad Help

[This is preliminary documentation and is subject to change.]

Groups records using the supplied key selector, and applies the given reduction function.

Namespace: Microsoft.Research.Naiad.Frameworks.DifferentialDataflow
Assembly: Microsoft.Research.Naiad.DifferentialDataflow (in Microsoft.Research.Naiad.DifferentialDataflow.dll) Version: 0.5.0.0 (0.5.0.0)
Syntax

C#
Collection<TOutput, TTime> GroupBy<TKey, TValue, TOutput>(
	Expression<Func<TRecord, TKey>> keySelector,
	Expression<Func<TRecord, TValue>> valueSelector,
	Func<TKey, IEnumerable<TValue>, IEnumerable<TOutput>> reducer
)
where TKey : Object, IEquatable<TKey>
where TValue : Object, IEquatable<TValue>
where TOutput : Object, IEquatable<TOutput>

Parameters

keySelector
Type: System.Linq.ExpressionsExpressionFuncTRecord, TKey
Function that extracts a key from each record.
valueSelector
Type: System.Linq.ExpressionsExpressionFuncTRecord, TValue
Function that transforms a record to the intermediate value that is stored for each record.
reducer
Type: SystemFuncTKey, IEnumerableTValue, IEnumerableTOutput
Function that transforms a sequence of intermediate values to a sequence of output records.

Type Parameters

TKey
The key type.
TValue
The intermediate value type.
TOutput
The result type.

Return Value

Type: CollectionTOutput, TTime
The collection of output records for each group in the input collection.
Remarks

This overload can reduce the amount of storage required compared to GroupByTKey, TOutput(ExpressionFuncTRecord, TKey, FuncTKey, IEnumerableTRecord, IEnumerableTOutput) in cases where the intermediate value is small relative to each original record. If the reducer is a commutative and associative aggregation function, consider using the AggregateTKey, TValue, TOutput(ExpressionFuncTRecord, TKey, ExpressionFuncTRecord, TValue, ExpressionFuncInt64, TValue, TValue, TValue, ExpressionFuncTValue, Boolean, ExpressionFuncTKey, TValue, TOutput) (or a related aggregation) operator, which stores a single value for each key, rather than a sequence of values.
See Also

Reference

CollectionTRecord, TTimeMaxTKey, TComparable, TValue(ExpressionFuncTRecord, TKey, ExpressionFuncTRecord, TValue, ExpressionFuncTKey, TValue, TComparable, ExpressionFuncTKey, TValue, TRecord)
CollectionTRecord, TTimeMinTKey, TComparable, TValue(ExpressionFuncTRecord, TKey, ExpressionFuncTRecord, TValue, ExpressionFuncTKey, TValue, TComparable, ExpressionFuncTKey, TValue, TRecord)
CollectionTRecord, TTimeSumTKey, TOutput(ExpressionFuncTRecord, TKey, ExpressionFuncTRecord, Int32, ExpressionFuncTKey, Int32, TOutput)