-
- Downloads
[SPARK-15159][SPARKR] SparkR SparkSession API
## What changes were proposed in this pull request? This PR introduces the new SparkSession API for SparkR. `sparkR.session.getOrCreate()` and `sparkR.session.stop()` "getOrCreate" is a bit unusual in R but it's important to name this clearly. SparkR implementation should - SparkSession is the main entrypoint (vs SparkContext; due to limited functionality supported with SparkContext in SparkR) - SparkSession replaces SQLContext and HiveContext (both a wrapper around SparkSession, and because of API changes, supporting all 3 would be a lot more work) - Changes to SparkSession is mostly transparent to users due to SPARK-10903 - Full backward compatibility is expected - users should be able to initialize everything just in Spark 1.6.1 (`sparkR.init()`), but with deprecation warning - Mostly cosmetic changes to parameter list - users should be able to move to `sparkR.session.getOrCreate()` easily - An advanced syntax with named parameters (aka varargs aka "...") is supported; that should be closer to the Builder syntax that is in Scala/Python (which unfortunately does not work in R because it will look like this: `enableHiveSupport(config(config(master(appName(builder(), "foo"), "local"), "first", "value"), "next, "value"))` - Updating config on an existing SparkSession is supported, the behavior is the same as Python, in which config is applied to both SparkContext and SparkSession - Some SparkSession changes are not matched in SparkR, mostly because it would be breaking API change: `catalog` object, `createOrReplaceTempView` - Other SQLContext workarounds are replicated in SparkR, eg. `tables`, `tableNames` - `sparkR` shell is updated to use the SparkSession entrypoint (`sqlContext` is removed, just like with Scale/Python) - All tests are updated to use the SparkSession entrypoint - A bug in `read.jdbc` is fixed TODO - [x] Add more tests - [ ] Separate PR - update all roxygen2 doc coding example - [ ] Separate PR - update SparkR programming guide ## How was this patch tested? unit tests, manual tests shivaram sun-rui rxin Author: Felix Cheung <felixcheung_m@hotmail.com> Author: felixcheung <felixcheung_m@hotmail.com> Closes #13635 from felixcheung/rsparksession.
Showing
- R/pkg/NAMESPACE 5 additions, 3 deletionsR/pkg/NAMESPACE
- R/pkg/R/DataFrame.R 2 additions, 6 deletionsR/pkg/R/DataFrame.R
- R/pkg/R/SQLContext.R 57 additions, 52 deletionsR/pkg/R/SQLContext.R
- R/pkg/R/backend.R 1 addition, 1 deletionR/pkg/R/backend.R
- R/pkg/R/sparkR.R 138 additions, 45 deletionsR/pkg/R/sparkR.R
- R/pkg/R/utils.R 9 additions, 0 deletionsR/pkg/R/utils.R
- R/pkg/inst/profile/shell.R 6 additions, 6 deletionsR/pkg/inst/profile/shell.R
- R/pkg/inst/tests/testthat/jarTest.R 2 additions, 2 deletionsR/pkg/inst/tests/testthat/jarTest.R
- R/pkg/inst/tests/testthat/packageInAJarTest.R 2 additions, 2 deletionsR/pkg/inst/tests/testthat/packageInAJarTest.R
- R/pkg/inst/tests/testthat/test_Serde.R 1 addition, 1 deletionR/pkg/inst/tests/testthat/test_Serde.R
- R/pkg/inst/tests/testthat/test_binaryFile.R 2 additions, 1 deletionR/pkg/inst/tests/testthat/test_binaryFile.R
- R/pkg/inst/tests/testthat/test_binary_function.R 2 additions, 1 deletionR/pkg/inst/tests/testthat/test_binary_function.R
- R/pkg/inst/tests/testthat/test_broadcast.R 2 additions, 1 deletionR/pkg/inst/tests/testthat/test_broadcast.R
- R/pkg/inst/tests/testthat/test_context.R 23 additions, 18 deletionsR/pkg/inst/tests/testthat/test_context.R
- R/pkg/inst/tests/testthat/test_includePackage.R 2 additions, 1 deletionR/pkg/inst/tests/testthat/test_includePackage.R
- R/pkg/inst/tests/testthat/test_mllib.R 1 addition, 4 deletionsR/pkg/inst/tests/testthat/test_mllib.R
- R/pkg/inst/tests/testthat/test_parallelize_collect.R 2 additions, 1 deletionR/pkg/inst/tests/testthat/test_parallelize_collect.R
- R/pkg/inst/tests/testthat/test_rdd.R 2 additions, 1 deletionR/pkg/inst/tests/testthat/test_rdd.R
- R/pkg/inst/tests/testthat/test_shuffle.R 2 additions, 1 deletionR/pkg/inst/tests/testthat/test_shuffle.R
- R/pkg/inst/tests/testthat/test_sparkSQL.R 69 additions, 17 deletionsR/pkg/inst/tests/testthat/test_sparkSQL.R
Loading
Please register or sign in to comment