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#117 from sun-rui/keyBy
Add keyBy() to the RDD class.
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ exportMethods( | |
"foreachPartition", | ||
"groupByKey", | ||
"join", | ||
"keyBy", | ||
"keys", | ||
"length", | ||
"lapply", | ||
|
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,28 @@ | ||
% Generated by roxygen2 (4.0.2): do not edit by hand | ||
\docType{methods} | ||
\name{keyBy} | ||
\alias{keyBy} | ||
\alias{keyBy,RDD} | ||
\alias{keyBy,RDD,function-method} | ||
\title{Creates tuples of the elements in this RDD by applying a function.} | ||
\usage{ | ||
keyBy(rdd, func) | ||
|
||
\S4method{keyBy}{RDD,`function`}(rdd, func) | ||
} | ||
\arguments{ | ||
\item{rdd}{The RDD.} | ||
|
||
\item{func}{The function to be applied.} | ||
} | ||
\description{ | ||
Creates tuples of the elements in this RDD by applying a function. | ||
} | ||
\examples{ | ||
\dontrun{ | ||
sc <- sparkR.init() | ||
rdd <- parallelize(sc, list(1, 2, 3)) | ||
collect(keyBy(rdd, function(x) { x*x })) # list(list(1, 1), list(4, 2), list(9, 3)) | ||
} | ||
} | ||
|