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.
[SPARKR-150] phase 1: implement sortBy() and sortByKey().
- Loading branch information
Sun Rui
committed
Feb 4, 2015
1 parent
554bda0
commit d9da451
Showing
6 changed files
with
194 additions
and
2 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 an (k, v) pair RDD by k.} | ||
\usage{ | ||
sortByKey(rdd, ascending, numPartitions) | ||
|
||
\S4method{sortByKey}{RDD,missingOrLogical,missingOrInteger}(rdd, ascending, | ||
numPartitions) | ||
} | ||
\arguments{ | ||
\item{rdd}{An (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 an (k, v) pair RDD by k. | ||
} | ||
\examples{ | ||
\dontrun{ | ||
sc <- sparkR.init() | ||
rdd <- parallelize(sc, list(list(3, 3), list(2, 2), list(1, 1))) | ||
collect(sortByKey(rdd)) # list (list(1, 1), list(2, 2), list(3, 3)) | ||
} | ||
} | ||
|