HpcLinqQueryable.Apply Method (IQueryable, IQueryable[], Expression)

Applies the specified function to the records from multiple sets of records.


Namespace: Microsoft.Hpc.Linq
Assembly: Microsoft.Hpc.Linq (in Microsoft.Hpc.Linq.dll)

'Usage
Dim source As IQueryable(Of T1)
Dim otherSources As IQueryable(Of T1)()
Dim applyFunc As Expression(Of Func(Of IEnumerable(Of T1)(), IEnumerable(Of T2)))
Dim returnValue As IQueryable(Of T2)

returnValue = HpcLinqQueryable.Apply(source, otherSources, applyFunc)

[ExtensionAttribute] 
public static IQueryable<T2> Apply<T1,T2> (
	IQueryable<T1> source,
	IQueryable<T1>[] otherSources,
	Expression<Func<IEnumerable<T1>[],IEnumerable<T2>>> applyFunc
)
J# supports the use of generic APIs, but not the declaration of new ones.
JScript does not support generic types or methods.

GenericParameters

T1

The type of the records in the sets of records that the source and otherSources parameters specify.

T2

The return type of the function that you specify in the applyFunc parameter.

Parameters

source

An System.Linq.IQueryable<T1> interface for the first set of records that you want to process.

otherSources

An array of System.Linq.IQueryable<T1> interfaces for the remaining sets of records that you want to process.

applyFunc

An System.Linq.Expressions.Expression(Func(IEnumerable<T1>, IEnumerable<T2>)) object that specifies the function that you want to apply to the records.

Return Value

An IQueryable interface that represents the set of records that result from applying the specified function to the input sets of records.

Exception typeCondition
ArgumentNullException

The specified source parameter is a null reference (Nothing in Visual Basic).

To apply a function to pairwise combinations of records from two sets of records, use the Apply(Generic IQueryable,Generic IQueryable,Generic Expression,Generic IEnumerable,Generic IEnumerable) form of the method. To apply a function to records from a single set of records, use the Apply(Generic IQueryable,Generic Expression,Generic IEnumerable) form of the function.

If the function that you specify in the applyFunc parameter is marked with the DistributiveOverConcat attribute, the function performs synchronized processing of the DSC files from all of the sets of input. All of the DSC files from the source1 parameter and all of the sets of records from the otherSources parameters are used. An exception occurs if all of the sources of input do not have the same number of DSC files, although the sources are not required to have the same number of records.

LINQ to HPC ignores the LeftDistributiveOverConcat attribute for the Apply(Generic IQueryable,Generic IQueryable,Generic Expression,Generic IEnumerable) method.

If the function that you specify in the applyFunc parameter is not marked with the DistributiveOverConcat attribute, the function runs on a single node. For each of the input sets of records, LINQ to HPC collects the records in a single enumerable object if records in the set are distributed across multiple compute nodes in the HPC cluster. LINQ to HPC then applies to the function to the records in the resulting enumerable objects on a single compute node. The output of the function is a single enumerable object that becomes the result of the Apply operation.

The enumerable objects that are passed to the function that the applyFunc parameter specifies are designed to be streamed. Therefore, you can call the GetEnumerator method on each of those objects only once, and cannot call the Reset method to change the position of the enumerators.

In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryable<TSource>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

This method has at least one parameter of type Expression with a type argument that is one of the Func types. For these parameters, you can pass in a lambda expression and it compiles to an Expression. For the Apply(Generic IQueryable,Generic IQueryable,Generic Expression,Generic IEnumerable,Generic IEnumerable) method, you should only use lambda expression in the form of x => function_name(x) or x => x.function_name(). When you specify a lambda expression with these forms, LINQ to HPC checks the attributes of function_name to determine if it is marked with the DistributiveOverConcat attribute. If you use a lambda expression of another form, such as one that includes compound expressions, LINQ to HPC ignores this attribute for any methods that occur in subexpressions, which could result in unintended behavior.

For more information about this method, see "N-Ary Apply" in the LINQ to HPC and DSC Programmer's Guide.

Platform Note: This method was introduced in Windows HPC Server 2008 R2 with Service Pack 2 (SP2) and is not supported in previous versions.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP, Windows Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012

Target Platforms

Windows XP, Windows Vista, Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, with HPC Pack Client Utilities




Build Date:

2013-04-22
Show: