diff options
author | Jeff Harrison <jeffrharrison@gmail.com> | 2015-04-27 13:38:25 -0700 |
---|---|---|
committer | Shivaram Venkataraman <shivaram@cs.berkeley.edu> | 2015-04-27 13:38:25 -0700 |
commit | 7078f6028bf012235c664b02ec3541cbb0a248a7 (patch) | |
tree | 5385a4ec5855801808bdb4424f1b1d9f509a67b0 | |
parent | 998aac21f0a0588a70f8cf123ae4080163c612fb (diff) | |
download | spark-7078f6028bf012235c664b02ec3541cbb0a248a7.tar.gz spark-7078f6028bf012235c664b02ec3541cbb0a248a7.tar.bz2 spark-7078f6028bf012235c664b02ec3541cbb0a248a7.zip |
[SPARK-6856] [R] Make RDD information more useful in SparkR
Author: Jeff Harrison <jeffrharrison@gmail.com>
Closes #5667 from His-name-is-Joof/joofspark and squashes the following commits:
f8814a6 [Jeff Harrison] newline added after RDD show() output
4d9d972 [Jeff Harrison] Merge branch 'master' into joofspark
9d2295e [Jeff Harrison] parallelize with 1:10
878b830 [Jeff Harrison] Merge branch 'master' into joofspark
c8c0b80 [Jeff Harrison] add test for RDD function show()
123be65 [Jeff Harrison] SPARK-6856
-rw-r--r-- | R/pkg/R/RDD.R | 5 | ||||
-rw-r--r-- | R/pkg/inst/tests/test_rdd.R | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/R/pkg/R/RDD.R b/R/pkg/R/RDD.R index 1662d6bb3b..f90c26b253 100644 --- a/R/pkg/R/RDD.R +++ b/R/pkg/R/RDD.R @@ -66,6 +66,11 @@ setMethod("initialize", "RDD", function(.Object, jrdd, serializedMode, .Object }) +setMethod("show", "RDD", + function(.Object) { + cat(paste(callJMethod(.Object@jrdd, "toString"), "\n", sep="")) + }) + setMethod("initialize", "PipelinedRDD", function(.Object, prev, func, jrdd_val) { .Object@env <- new.env() .Object@env$isCached <- FALSE diff --git a/R/pkg/inst/tests/test_rdd.R b/R/pkg/inst/tests/test_rdd.R index d55af93e3e..03207353c3 100644 --- a/R/pkg/inst/tests/test_rdd.R +++ b/R/pkg/inst/tests/test_rdd.R @@ -759,6 +759,11 @@ test_that("collectAsMap() on a pairwise RDD", { expect_equal(vals, list(`1` = "a", `2` = "b")) }) +test_that("show()", { + rdd <- parallelize(sc, list(1:10)) + expect_output(show(rdd), "ParallelCollectionRDD\\[\\d+\\] at parallelize at RRDD\\.scala:\\d+") +}) + test_that("sampleByKey() on pairwise RDDs", { rdd <- parallelize(sc, 1:2000) pairsRDD <- lapply(rdd, function(x) { if (x %% 2 == 0) list("a", x) else list("b", x) }) |