forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#154 from sun-rui/SPARKR-150
[SPARKR-150] phase 1: implement sortBy() and sortByKey().
- Loading branch information
Showing
6 changed files
with
234 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
% Generated by roxygen2 (4.0.2): do not edit by hand | ||
\docType{methods} | ||
\name{sortBy} | ||
\alias{sortBy} | ||
\alias{sortBy,RDD,RDD-method} | ||
\alias{sortBy,RDD,function,missingOrLogical,missingOrInteger-method} | ||
\title{Sort an RDD by the given key function.} | ||
\usage{ | ||
sortBy(rdd, func, ascending, numPartitions) | ||
|
||
\S4method{sortBy}{RDD,`function`,missingOrLogical,missingOrInteger}(rdd, func, | ||
ascending, numPartitions) | ||
} | ||
\arguments{ | ||
\item{rdd}{An RDD to be sorted.} | ||
|
||
\item{func}{A function used to compute the sort key for each element.} | ||
|
||
\item{ascending}{A flag to indicate whether the sorting is ascending or descending.} | ||
|
||
\item{numPartitions}{Number of partitions to create.} | ||
} | ||
\value{ | ||
An RDD where all elements are sorted. | ||
} | ||
\description{ | ||
Sort an RDD by the given key function. | ||
} | ||
\examples{ | ||
\dontrun{ | ||
sc <- sparkR.init() | ||
rdd <- parallelize(sc, list(3, 2, 1)) | ||
collect(sortBy(rdd, function(x) { x })) # list (1, 2, 3) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
% Generated by roxygen2 (4.0.2): do not edit by hand | ||
\docType{methods} | ||
\name{sortByKey} | ||
\alias{sortByKey} | ||
\alias{sortByKey,RDD,RDD-method} | ||
\alias{sortByKey,RDD,missingOrLogical,missingOrInteger-method} | ||
\title{Sort a (k, v) pair RDD by k.} | ||
\usage{ | ||
sortByKey(rdd, ascending, numPartitions) | ||
|
||
\S4method{sortByKey}{RDD,missingOrLogical,missingOrInteger}(rdd, ascending, | ||
numPartitions) | ||
} | ||
\arguments{ | ||
\item{rdd}{A (k, v) pair RDD to be sorted.} | ||
|
||
\item{ascending}{A flag to indicate whether the sorting is ascending or descending.} | ||
|
||
\item{numPartitions}{Number of partitions to create.} | ||
} | ||
\value{ | ||
An RDD where all (k, v) pair elements are sorted. | ||
} | ||
\description{ | ||
Sort a (k, v) pair RDD by k. | ||
} | ||
\examples{ | ||
\dontrun{ | ||
sc <- sparkR.init() | ||
rdd <- parallelize(sc, list(list(3, 1), list(2, 2), list(1, 3))) | ||
collect(sortByKey(rdd)) # list (list(1, 3), list(2, 2), list(3, 1)) | ||
} | ||
} | ||
|