spark-instrumented-optimizer/R/pkg/tests/fulltests
hyukjinkwon a8d9ec8a60 [SPARK-21780][R] Simpler Dataset.sample API in R
## What changes were proposed in this pull request?

This PR make `sample(...)` able to omit `withReplacement` defaulting to `FALSE`.

In short, the following examples are allowed:

```r
> df <- createDataFrame(as.list(seq(10)))
> count(sample(df, fraction=0.5, seed=3))
[1] 4
> count(sample(df, fraction=1.0))
[1] 10
```

In addition, this PR also adds some type checking logics as below:

```r
> sample(df, fraction = "a")
Error in sample(df, fraction = "a") :
  fraction must be numeric; however, got character
> sample(df, fraction = 1, seed = NULL)
Error in sample(df, fraction = 1, seed = NULL) :
  seed must not be NULL or NA; however, got NULL
> sample(df, list(1), 1.0)
Error in sample(df, list(1), 1) :
  withReplacement must be logical; however, got list
> sample(df, fraction = -1.0)
...
Error in sample : illegal argument - requirement failed: Sampling fraction (-1.0) must be on interval [0, 1] without replacement
```

## How was this patch tested?

Manually tested, unit tests added in `R/pkg/tests/fulltests/test_sparkSQL.R`.

Author: hyukjinkwon <gurwls223@gmail.com>

Closes #19243 from HyukjinKwon/SPARK-21780.
2017-09-21 20:16:25 +09:00
..
jarTest.R [SPARK-20877][SPARKR] refactor tests to basic tests only for CRAN 2017-06-11 00:00:33 -07:00
packageInAJarTest.R [SPARK-20877][SPARKR] refactor tests to basic tests only for CRAN 2017-06-11 00:00:33 -07:00
test_binary_function.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_binaryFile.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_broadcast.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_client.R [SPARK-19810][BUILD][CORE] Remove support for Scala 2.10 2017-07-13 17:06:24 +08:00
test_context.R [SPARK-21149][R] Add job description API for R 2017-06-23 09:59:24 -07:00
test_includePackage.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_jvm_api.R [SPARK-20877][SPARKR] refactor tests to basic tests only for CRAN 2017-06-11 00:00:33 -07:00
test_mllib_classification.R [SPARK-21381][SPARKR] SparkR: pass on setHandleInvalid for classification algorithms 2017-07-31 20:37:06 -07:00
test_mllib_clustering.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_mllib_fpm.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_mllib_recommendation.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_mllib_regression.R [SPARK-21622][ML][SPARKR] Support offset in SparkR GLM 2017-08-06 15:14:12 -07:00
test_mllib_stat.R [SPARK-20877][SPARKR] refactor tests to basic tests only for CRAN 2017-06-11 00:00:33 -07:00
test_mllib_tree.R [SPARK-21801][SPARKR][TEST] unit test randomly fail with randomforest 2017-08-29 10:09:41 -07:00
test_parallelize_collect.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_rdd.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_Serde.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_shuffle.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_sparkR.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_sparkSQL.R [SPARK-21780][R] Simpler Dataset.sample API in R 2017-09-21 20:16:25 +09:00
test_streaming.R [SPARK-21224][R] Specify a schema by using a DDL-formatted string when reading in R 2017-06-28 19:36:00 -07:00
test_take.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_textFile.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_utils.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00
test_Windows.R [SPARK-20877][SPARKR][FOLLOWUP] clean up after test move 2017-06-11 03:00:44 -07:00