Skip to content

Commit 046bc9e

Browse files
author
Sun Rui
committed
Clean split usage in tests.
1 parent d531c86 commit 046bc9e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

R/pkg/inst/tests/test_rdd.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ test_that("several transformations on RDD (a benchmark on PipelinedRDD)", {
105105
rdd2 <- rdd
106106
for (i in 1:12)
107107
rdd2 <- lapplyPartitionsWithIndex(
108-
rdd2, function(split, part) {
109-
part <- as.list(unlist(part) * split + i)
108+
rdd2, function(partIndex, part) {
109+
part <- as.list(unlist(part) * partIndex + i)
110110
})
111111
rdd2 <- lapply(rdd2, function(x) x + x)
112112
actual <- collect(rdd2)
@@ -121,8 +121,8 @@ test_that("PipelinedRDD support actions: cache(), persist(), unpersist(), checkp
121121
# PipelinedRDD
122122
rdd2 <- lapplyPartitionsWithIndex(
123123
rdd2,
124-
function(split, part) {
125-
part <- as.list(unlist(part) * split)
124+
function(partIndex, part) {
125+
part <- as.list(unlist(part) * partIndex)
126126
})
127127

128128
cache(rdd2)
@@ -174,13 +174,13 @@ test_that("lapply with dependency", {
174174
})
175175

176176
test_that("lapplyPartitionsWithIndex on RDDs", {
177-
func <- function(splitIndex, part) { list(splitIndex, Reduce("+", part)) }
177+
func <- function(partIndex, part) { list(partIndex, Reduce("+", part)) }
178178
actual <- collect(lapplyPartitionsWithIndex(rdd, func), flatten = FALSE)
179179
expect_equal(actual, list(list(0, 15), list(1, 40)))
180180

181181
pairsRDD <- parallelize(sc, list(list(1, 2), list(3, 4), list(4, 8)), 1L)
182182
partitionByParity <- function(key) { if (key %% 2 == 1) 0 else 1 }
183-
mkTup <- function(splitIndex, part) { list(splitIndex, part) }
183+
mkTup <- function(partIndex, part) { list(partIndex, part) }
184184
actual <- collect(lapplyPartitionsWithIndex(
185185
partitionBy(pairsRDD, 2L, partitionByParity),
186186
mkTup),

0 commit comments

Comments
 (0)