diff options
author | Yanbo Liang <ybliang8@gmail.com> | 2016-02-25 21:23:41 -0800 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2016-02-25 21:23:41 -0800 |
commit | 50e60e36f7775a10cf39338e7c5716578a24d89f (patch) | |
tree | e0e0a09f875576531ef7f33e81004680fae5041b /R/pkg/inst | |
parent | f3be369ef7b78944ce9cafc94b19df52772cea58 (diff) | |
download | spark-50e60e36f7775a10cf39338e7c5716578a24d89f.tar.gz spark-50e60e36f7775a10cf39338e7c5716578a24d89f.tar.bz2 spark-50e60e36f7775a10cf39338e7c5716578a24d89f.zip |
[SPARK-13504] [SPARKR] Add approxQuantile for SparkR
## What changes were proposed in this pull request?
Add ```approxQuantile``` for SparkR.
## How was this patch tested?
unit tests
Author: Yanbo Liang <ybliang8@gmail.com>
Closes #11383 from yanboliang/spark-13504 and squashes the following commits:
4f17adb [Yanbo Liang] Add approxQuantile for SparkR
Diffstat (limited to 'R/pkg/inst')
-rw-r--r-- | R/pkg/inst/tests/testthat/test_sparkSQL.R | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R b/R/pkg/inst/tests/testthat/test_sparkSQL.R index cc118108f6..236bae6bde 100644 --- a/R/pkg/inst/tests/testthat/test_sparkSQL.R +++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R @@ -1785,6 +1785,14 @@ test_that("sampleBy() on a DataFrame", { expect_identical(as.list(result[2, ]), list(key = "1", count = 7)) }) +test_that("approxQuantile() on a DataFrame", { + l <- lapply(c(0:99), function(i) { i }) + df <- createDataFrame(sqlContext, l, "key") + quantiles <- approxQuantile(df, "key", c(0.5, 0.8), 0.0) + expect_equal(quantiles[[1]], 50) + expect_equal(quantiles[[2]], 80) +}) + test_that("SQL error message is returned from JVM", { retError <- tryCatch(sql(sqlContext, "select * from blah"), error = function(e) e) expect_equal(grepl("Table not found: blah", retError), TRUE) |