HpcLinqQueryable.RangePartition Method (IQueryable, Expression, IComparer, Boolean, Int32)

Divides a set of records into the specified number of DSC files by using dynamic sampling to choose range separators, and associates each DSC file with a range of values for a key that the specified function generates from the records. The range separators are sorted by using the specified sort order, and the specified custom comparison object is used to compare the keys to the range separators.

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

Usage

'Usage
Dim source As IQueryable(Of TSource)
Dim keySelector As Expression(Of Func(Of TSource, TKey))
Dim comparer As IComparer(Of TKey)
Dim isDescending As Boolean
Dim partitionCount As Integer
Dim returnValue As IQueryable(Of TSource)

returnValue = HpcLinqQueryable.RangePartition(source, keySelector, comparer, isDescending, partitionCount)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function RangePartition(Of TSource, TKey) ( _
    source As IQueryable(Of TSource), _
    keySelector As Expression(Of Func(Of TSource, TKey)), _
    comparer As IComparer(Of TKey), _
    isDescending As Boolean, _
    partitionCount As Integer _
) As IQueryable(Of TSource)
[ExtensionAttribute] 
public static IQueryable<TSource> RangePartition<TSource,TKey> (
    IQueryable<TSource> source,
    Expression<Func<TSource,TKey>> keySelector,
    IComparer<TKey> comparer,
    bool isDescending,
    int partitionCount
)
[ExtensionAttribute] 
public:
generic<typename TSource, typename TKey>
static IQueryable<TSource>^ RangePartition (
    IQueryable<TSource>^ source, 
    Expression<Func<TSource, TKey>^>^ keySelector, 
    IComparer<TKey>^ comparer, 
    bool isDescending, 
    int partitionCount
)
J# supports the use of generic APIs, but not the declaration of new ones.
JScript does not support generic types or methods.

GenericParameters

  • TSource
    The type of the records in the source parameter.
  • TKey
    The return type of the function that you specify in the keySelector parameter to generate the key from a record.

Parameters

  • source
    A System.Linq.IQueryable<TSource> interface for the set of records that you want to divide into DSC files.
  • keySelector
    A System.Linq.Expressions.Expression(Func(TSource, TKey)) object that specifies a function that generates a key from each record. The range partition operation divides the records into DSC files by using the value of this key.
  • comparer
    An IComparer<TKey> interface that you want to use for comparing the key for a record to the range separators and for sorting the records.
  • isDescending
    A Boolean that specifies whether to sort the range separators for the DSC file in descending order. True specifies that the range separators should be sorted in descending order, so that the records with the largest values are in the first DSC file. False specifies that the range separators should be sorted in ascending order, so that the records with the smallest values are in the first DSC file.
  • partitionCount
    An Int32 that specifies the number of DSC files to use for the partitioned set of records.

Return Value

A IQueryable interface that represents the set of records divided according to the value of the key for the record.

Exceptions

Exception type Condition
ArgumentNullException

The specified source, keySelector, or partitionCount parameter is a null reference (Nothing in Visual Basic).

Remarks

Use the ToDsc method to write the partitioned set of records to a DSC file set.

This version of the RangePartition method uses dynamic sampling of the input file set to create range separators that create DSC files of approximately equal size.

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.

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

Thread Safety

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

Platforms

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

See Also

Reference

HpcLinqQueryable Class
HpcLinqQueryable Members
Microsoft.Hpc.Linq Namespace

Build Date:

2013-04-22