CheckOrderBy <TSource, TKey>(this IQueryable <TSource> source,
                              Expression <Func <TSource, TKey> > keySelector,
                              IComparer <TKey> comparer,
                              bool isDescending)
 {
     return(source.ApplyPerPartition(x_1 => HpcLinqHelper.CheckSort(x_1, keySelector, comparer, isDescending)));
 }
        /// <summary>
        /// Broadcast a dataset to n partitions.
        /// </summary>
        /// <typeparam name="T">The type of the input records</typeparam>
        /// <param name="source">The input dataset</param>
        /// <returns>The output dataset, each partition of which is a copy of source</returns>
        public static IQueryable <T> BroadCast <T>(this IQueryable <T> source, int n)
        {
            var dummy = source.ApplyPerPartition(x => HpcLinqHelper.ValueZero(x))
                        .HashPartition(x => x, n);

            return(dummy.ApplyPerPartition(source, (x, y) => HpcLinqHelper.SelectSecond(x, y), true));
        }
 /// <summary>
 /// Broadcast a dataset to multiple partitions
 /// </summary>
 /// <typeparam name="T">The type of the input records</typeparam>
 /// <param name="source">The input dataset</param>
 /// <returns>The output dataset, which consists of multiple copies of source</returns>
 public static IQueryable <T> BroadCast <T>(this IQueryable <T> source)
 {
     return(source.ApplyPerPartition(source, (x, y) => HpcLinqHelper.SelectSecond(x, y), true));
 }
 CrossProduct <T1, T2, T3>(this IQueryable <T1> source1,
                           IQueryable <T2> source2,
                           Expression <Func <T1, T2, T3> > procFunc)
 {
     return(source1.ApplyPerPartition(source2, (x_1, y_1) => HpcLinqHelper.Cross(x_1, y_1, procFunc), true));
 }