diff options
author | trestletech <jeff.allen@trestletechnology.net> | 2015-07-28 10:45:19 -0700 |
---|---|---|
committer | Shivaram Venkataraman <shivaram@cs.berkeley.edu> | 2015-07-28 10:45:19 -0700 |
commit | 614323406225a3522ee601935ce3052449614145 (patch) | |
tree | 1fcc3864f2dcd27c7ed9f00b91c1b87063d88e09 /R/pkg | |
parent | 35ef853b3f9d955949c464e4a0d445147e0e9a07 (diff) | |
download | spark-614323406225a3522ee601935ce3052449614145.tar.gz spark-614323406225a3522ee601935ce3052449614145.tar.bz2 spark-614323406225a3522ee601935ce3052449614145.zip |
Use vector-friendly comparison for packages argument.
Otherwise, `sparkR.init()` with multiple `sparkPackages` results in this warning:
```
Warning message:
In if (packages != "") { :
the condition has length > 1 and only the first element will be used
```
Author: trestletech <jeff.allen@trestletechnology.net>
Closes #7701 from trestletech/compare-packages and squashes the following commits:
72c8b36 [trestletech] Correct function name.
c52db0e [trestletech] Added test for multiple packages.
3aab1a7 [trestletech] Use vector-friendly comparison for packages argument.
Diffstat (limited to 'R/pkg')
-rw-r--r-- | R/pkg/R/client.R | 2 | ||||
-rw-r--r-- | R/pkg/inst/tests/test_client.R | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/R/pkg/R/client.R b/R/pkg/R/client.R index 6f772158dd..c811d1dac3 100644 --- a/R/pkg/R/client.R +++ b/R/pkg/R/client.R @@ -48,7 +48,7 @@ generateSparkSubmitArgs <- function(args, sparkHome, jars, sparkSubmitOpts, pack jars <- paste("--jars", jars) } - if (packages != "") { + if (!identical(packages, "")) { packages <- paste("--packages", packages) } diff --git a/R/pkg/inst/tests/test_client.R b/R/pkg/inst/tests/test_client.R index 30b05c1a2a..8a20991f89 100644 --- a/R/pkg/inst/tests/test_client.R +++ b/R/pkg/inst/tests/test_client.R @@ -30,3 +30,7 @@ test_that("no package specified doesn't add packages flag", { expect_equal(gsub("[[:space:]]", "", args), "") }) + +test_that("multiple packages don't produce a warning", { + expect_that(generateSparkSubmitArgs("", "", "", "", c("A", "B")), not(gives_warning())) +}) |