You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yanboliang <gi...@git.apache.org> on 2015/12/13 12:00:17 UTC

[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

GitHub user yanboliang opened a pull request:

    https://github.com/apache/spark/pull/10281

    [SPARK-12310] [SparkR] Add write.json and write.parquet for SparkR

    Add ```write.json``` and ```write.parquet``` for SparkR, and deprecated ```saveAsParquetFile```.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/yanboliang/spark spark-12310

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/10281.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #10281
    
----
commit e19a100236d3cf6213a0268ca461d99f099ddf6b
Author: Yanbo Liang <yb...@gmail.com>
Date:   2015-12-13T10:59:11Z

    Add write.json and write.parquet for SparkR

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164258058
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47449353
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -371,13 +371,13 @@ test_that("Collect DataFrame with complex types", {
       expect_equal(bob$height, 176.5)
     })
     
    -test_that("read.json()/jsonFile() on a local file returns a DataFrame", {
    +test_that("read.json()/jsonFile() and write.json()", {
       df <- read.json(sqlContext, jsonPath)
       expect_is(df, "DataFrame")
       expect_equal(count(df), 3)
       # read.json()/jsonFile() works with multiple input paths
       jsonPath2 <- tempfile(pattern="jsonPath2", fileext=".json")
    -  write.df(df, jsonPath2, "json", mode="overwrite")
    +  write.json(df, jsonPath2)
    --- End diff --
    
    I think it actually make sense to have a test for `write.df` with additional option (in this case `mode="overwrite"`) - is there a reason for removing this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47458826
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -1448,23 +1457,28 @@ test_that("write.df() on DataFrame and works with read.parquet", {
       expect_equal(count(df), count(parquetDF))
     })
     
    -test_that("read.parquet()/parquetFile() works with multiple input paths", {
    +test_that("read.parquet()/parquetFile() and write.parquet()/saveAsParquetFile()", {
    --- End diff --
    
    I will reorg the test cases, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by sun-rui <gi...@git.apache.org>.
Github user sun-rui commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164995852
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164342424
  
    **[Test build #47638 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47638/consoleFull)** for PR 10281 at commit [`50d442e`](https://github.com/apache/spark/commit/50d442ebca113ca49fc363e21ce32fb3f78f5bb1).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164343853
  
    **[Test build #47638 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47638/consoleFull)** for PR 10281 at commit [`50d442e`](https://github.com/apache/spark/commit/50d442ebca113ca49fc363e21ce32fb3f78f5bb1).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164343893
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47458635
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -371,13 +371,13 @@ test_that("Collect DataFrame with complex types", {
       expect_equal(bob$height, 176.5)
     })
     
    -test_that("read.json()/jsonFile() on a local file returns a DataFrame", {
    +test_that("read.json()/jsonFile() and write.json()", {
       df <- read.json(sqlContext, jsonPath)
       expect_is(df, "DataFrame")
       expect_equal(count(df), 3)
       # read.json()/jsonFile() works with multiple input paths
       jsonPath2 <- tempfile(pattern="jsonPath2", fileext=".json")
    -  write.df(df, jsonPath2, "json", mode="overwrite")
    +  write.json(df, jsonPath2)
    --- End diff --
    
    I agree to have a test for ```write.df```, but it still exists even I removing this such as [here](https://github.com/apache/spark/blob/master/R/pkg/inst/tests/testthat/test_sparkSQL.R#L870).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by sun-rui <gi...@git.apache.org>.
Github user sun-rui commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47456558
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -1448,23 +1457,28 @@ test_that("write.df() on DataFrame and works with read.parquet", {
       expect_equal(count(df), count(parquetDF))
     })
     
    -test_that("read.parquet()/parquetFile() works with multiple input paths", {
    +test_that("read.parquet()/parquetFile() and write.parquet()/saveAsParquetFile()", {
    --- End diff --
    
    How about renaming this test case to "read/write Parquet files", where read.parquet(), parquetFile(), read.df(), write.parquet(), saveAsParquetFile(), write.df() are tested to read/write json files. This test case can be merged with the one "write.df() as parquet file"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by sun-rui <gi...@git.apache.org>.
Github user sun-rui commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47456534
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -371,13 +371,13 @@ test_that("Collect DataFrame with complex types", {
       expect_equal(bob$height, 176.5)
     })
     
    -test_that("read.json()/jsonFile() on a local file returns a DataFrame", {
    --- End diff --
    
    How about renaming this test case to "read/write json files", where read.json(), jsonFile(), read.df(), write.json(), write.df() are tested to read/write json files. This test case can be merged with the one "read.df() from json file"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47449369
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -454,6 +454,8 @@ test_that("insertInto() on a registered table", {
       expect_equal(count(sql(sqlContext, "select * from table1")), 2)
       expect_equal(first(sql(sqlContext, "select * from table1 order by age"))$name, "Bob")
       dropTempTable(sqlContext, "table1")
    +
    +  unlink(parquetPath2)
    --- End diff --
    
    should there be `unlink(jsonPath2)` as well? if so could you please add that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164258061
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47626/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/10281


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164257767
  
    **[Test build #47626 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47626/consoleFull)** for PR 10281 at commit [`e19a100`](https://github.com/apache/spark/commit/e19a100236d3cf6213a0268ca461d99f099ddf6b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47449336
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -614,12 +641,25 @@ setMethod("toJSON",
     #' sqlContext <- sparkRSQL.init(sc)
     #' path <- "path/to/file.json"
     #' df <- read.json(sqlContext, path)
    -#' saveAsParquetFile(df, "/tmp/sparkr-tmp/")
    +#' write.parquet(df, "/tmp/sparkr-tmp1/")
    +#' saveAsParquetFile(df, "/tmp/sparkr-tmp2/")
     #'}
    +setMethod("write.parquet",
    +          signature(x = "DataFrame", path = "character"),
    +          function(x, path) {
    +            write <- callJMethod(x@sdf, "write")
    +            invisible(callJMethod(write, "parquet", path))
    +          })
    +
    +#' @family DataFrame functions
    --- End diff --
    
    putting @family here would create multiple "See Also" section in the resulting html page, we would only need one for all those with the same @rdname


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10281#discussion_r47458647
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -614,12 +641,25 @@ setMethod("toJSON",
     #' sqlContext <- sparkRSQL.init(sc)
     #' path <- "path/to/file.json"
     #' df <- read.json(sqlContext, path)
    -#' saveAsParquetFile(df, "/tmp/sparkr-tmp/")
    +#' write.parquet(df, "/tmp/sparkr-tmp1/")
    +#' saveAsParquetFile(df, "/tmp/sparkr-tmp2/")
     #'}
    +setMethod("write.parquet",
    +          signature(x = "DataFrame", path = "character"),
    +          function(x, path) {
    +            write <- callJMethod(x@sdf, "write")
    +            invisible(callJMethod(write, "parquet", path))
    +          })
    +
    +#' @family DataFrame functions
    --- End diff --
    
    Good point.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164255617
  
    **[Test build #47626 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47626/consoleFull)** for PR 10281 at commit [`e19a100`](https://github.com/apache/spark/commit/e19a100236d3cf6213a0268ca461d99f099ddf6b).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-164343894
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47638/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12310] [SparkR] Add write.json and writ...

Posted by shivaram <gi...@git.apache.org>.
Github user shivaram commented on the pull request:

    https://github.com/apache/spark/pull/10281#issuecomment-165205384
  
    LGTM. Thanks @yanboliang and @sun-rui -- Merging this to master and branch-1.6


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org