aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests
diff options
context:
space:
mode:
authorSun Rui <rui.sun@intel.com>2015-04-24 11:00:19 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-04-24 11:00:19 -0700
commitebb77b2aff085e71906b5de9d266ded89051af82 (patch)
treef36e4927c100bb07955b1bf31cd18aa0e7619d63 /R/pkg/inst/tests
parent6e57d57b32ba2aa0514692074897b5edd34e0dd6 (diff)
downloadspark-ebb77b2aff085e71906b5de9d266ded89051af82.tar.gz
spark-ebb77b2aff085e71906b5de9d266ded89051af82.tar.bz2
spark-ebb77b2aff085e71906b5de9d266ded89051af82.zip
[SPARK-7033] [SPARKR] Clean usage of split. Use partition instead where applicable.
Author: Sun Rui <rui.sun@intel.com> Closes #5628 from sun-rui/SPARK-7033 and squashes the following commits: 046bc9e [Sun Rui] Clean split usage in tests. d531c86 [Sun Rui] [SPARK-7033][SPARKR] Clean usage of split. Use partition instead where applicable.
Diffstat (limited to 'R/pkg/inst/tests')
-rw-r--r--R/pkg/inst/tests/test_rdd.R12
1 files changed, 6 insertions, 6 deletions
diff --git a/R/pkg/inst/tests/test_rdd.R b/R/pkg/inst/tests/test_rdd.R
index 3ba7d17163..d55af93e3e 100644
--- a/R/pkg/inst/tests/test_rdd.R
+++ b/R/pkg/inst/tests/test_rdd.R
@@ -105,8 +105,8 @@ test_that("several transformations on RDD (a benchmark on PipelinedRDD)", {
rdd2 <- rdd
for (i in 1:12)
rdd2 <- lapplyPartitionsWithIndex(
- rdd2, function(split, part) {
- part <- as.list(unlist(part) * split + i)
+ rdd2, function(partIndex, part) {
+ part <- as.list(unlist(part) * partIndex + i)
})
rdd2 <- lapply(rdd2, function(x) x + x)
actual <- collect(rdd2)
@@ -121,8 +121,8 @@ test_that("PipelinedRDD support actions: cache(), persist(), unpersist(), checkp
# PipelinedRDD
rdd2 <- lapplyPartitionsWithIndex(
rdd2,
- function(split, part) {
- part <- as.list(unlist(part) * split)
+ function(partIndex, part) {
+ part <- as.list(unlist(part) * partIndex)
})
cache(rdd2)
@@ -174,13 +174,13 @@ test_that("lapply with dependency", {
})
test_that("lapplyPartitionsWithIndex on RDDs", {
- func <- function(splitIndex, part) { list(splitIndex, Reduce("+", part)) }
+ func <- function(partIndex, part) { list(partIndex, Reduce("+", part)) }
actual <- collect(lapplyPartitionsWithIndex(rdd, func), flatten = FALSE)
expect_equal(actual, list(list(0, 15), list(1, 40)))
pairsRDD <- parallelize(sc, list(list(1, 2), list(3, 4), list(4, 8)), 1L)
partitionByParity <- function(key) { if (key %% 2 == 1) 0 else 1 }
- mkTup <- function(splitIndex, part) { list(splitIndex, part) }
+ mkTup <- function(partIndex, part) { list(partIndex, part) }
actual <- collect(lapplyPartitionsWithIndex(
partitionBy(pairsRDD, 2L, partitionByParity),
mkTup),