You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by dongjoon-hyun <gi...@git.apache.org> on 2016/06/20 20:49:33 UTC

[GitHub] spark pull request #13786: [SPARK-15294][R] Add `pivot` to SparkR

GitHub user dongjoon-hyun opened a pull request:

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

    [SPARK-15294][R] Add `pivot` to SparkR

    ## What changes were proposed in this pull request?
    
    This PR adds `pivot` function to SparkR for API parity. Since this PR is based on https://github.com/apache/spark/pull/13295 , @mhnatiuk should be credited for the work he did.
    
    ## How was this patch tested?
    
    Pass the Jenkins tests (including new testcase.)

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

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-15294

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

    https://github.com/apache/spark/pull/13786.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 #13786
    
----
commit 54b9dbceb988866924ae6c0f2e08c8c98b25f383
Author: Dongjoon Hyun <do...@apache.org>
Date:   2016-06-20T20:44:45Z

    [SPARK-15294][R] Add `pivot` to 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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67772333
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -1397,6 +1397,26 @@ test_that("group by, agg functions", {
       unlink(jsonPath3)
     })
     
    +test_that("pivot GroupedData column", {
    +  df <- createDataFrame(data.frame(
    +    earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +    course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +    year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +  ))
    +  sum1 <- collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +  sum2 <- collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +  sum3 <- collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    +
    +  correct_answer <- data.frame(
    +    year = c(2013, 2014, 2015, 2016),
    +    Python = c(10000, 15000, 20000, 22000),
    +    R = c(10000, 11000, 12000, 21000)
    +  )
    +  expect_equal(sum1, correct_answer)
    +  expect_equal(sum2, correct_answer)
    +  expect_equal(sum3, correct_answer)
    --- End diff --
    
    Sure! I'll 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    LGTM. Merging this to master, branch-2.0


---
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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67778309
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @family agg
    +#' @name pivot
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' df <- createDataFrame(data.frame(
    +#'     earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +#'     course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +#'     year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +#' ))
    +#' collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", "R"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    +#' }
    +#' @note pivot since 2.0.0
    +setMethod("pivot",
    +          signature(x = "GroupedData"),
    +          function(x, colname, values = list()){
    --- End diff --
    
    it might be better to add a type check for `colname` or add it to the signature


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by Div333 <gi...@git.apache.org>.
Github user Div333 commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Hello everyone,  Thanks a lot for implementing the pivot functionality. I have started using SparkR recently and would like to know if the pivot method is included in the library as I don't find it in the documentation. Also, I am looking to use the unpivot functionality. It would be great if it is included.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60898/
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60885/
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60874 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60874/consoleFull)** for PR 13786 at commit [`cb5db57`](https://github.com/apache/spark/commit/cb5db576d678f3c6b627aee03f1eaebdb9ad6531).


---
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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67779461
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @family agg
    +#' @name pivot
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' df <- createDataFrame(data.frame(
    +#'     earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +#'     course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +#'     year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +#' ))
    +#' collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", "R"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    +#' }
    +#' @note pivot since 2.0.0
    +setMethod("pivot",
    +          signature(x = "GroupedData"),
    +          function(x, colname, values = list()){
    --- End diff --
    
    Sure. I'll add that. Thank you!


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60883 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60883/consoleFull)** for PR 13786 at commit [`da92ae4`](https://github.com/apache/spark/commit/da92ae482a40fcffcefca15b70627c278a86a9fc).


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67779404
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @family agg
    --- End diff --
    
    Do you mean simply to delete this line?


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Thank you for review, @shivaram and @felixcheung .
    Now, it's ready for review again.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60898 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60898/consoleFull)** for PR 13786 at commit [`63ef66b`](https://github.com/apache/spark/commit/63ef66b2709a0b31b3e287065124f297d941a946).
     * 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60899/
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Merged build finished. Test FAILed.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60878 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60878/consoleFull)** for PR 13786 at commit [`c462296`](https://github.com/apache/spark/commit/c4622960754fb85f073c52232d4e8593ee619d10).


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60883/
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60899 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60899/consoleFull)** for PR 13786 at commit [`f2b010e`](https://github.com/apache/spark/commit/f2b010e87aa72d7b9cf1ce2de75dd91023fe4d22).


---
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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

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


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by mhnatiuk <gi...@git.apache.org>.
Github user mhnatiuk commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Thanks @dongjoon-hyun @shivaram  and all. I haven't got time to finish this fully, so thanks for picking this up!!


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60883 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60883/consoleFull)** for PR 13786 at commit [`da92ae4`](https://github.com/apache/spark/commit/da92ae482a40fcffcefca15b70627c278a86a9fc).
     * 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60872 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60872/consoleFull)** for PR 13786 at commit [`54b9dbc`](https://github.com/apache/spark/commit/54b9dbceb988866924ae6c0f2e08c8c98b25f383).


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60872/
    Test FAILed.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by Div333 <gi...@git.apache.org>.
Github user Div333 commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Hi,
    @mhnatiuk @dongjoon-hyun  Thanks for your quick response. Yes, I am looking for equivalent of reshape2::melt function.
    



---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60874/
    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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67778153
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @family agg
    --- End diff --
    
    this doesn't seem right. I check I don't think we have an existing family tag for GroupedData functions, so perhaps we could leave this out


---
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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67778522
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @family agg
    +#' @name pivot
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' df <- createDataFrame(data.frame(
    +#'     earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +#'     course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +#'     year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +#' ))
    +#' collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", "R"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    +#' }
    +#' @note pivot since 2.0.0
    +setMethod("pivot",
    +          signature(x = "GroupedData"),
    +          function(x, colname, values = list()){
    --- End diff --
    
    should we check length(colname) == 1? it would more obvious to check here then it failing on the JVM side.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67797294
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @name pivot
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' df <- createDataFrame(data.frame(
    +#'     earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +#'     course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +#'     year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +#' ))
    +#' collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", "R"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    --- End diff --
    
    ... and change one from `sum(` to `mean(` for example.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60874 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60874/consoleFull)** for PR 13786 at commit [`cb5db57`](https://github.com/apache/spark/commit/cb5db576d678f3c6b627aee03f1eaebdb9ad6531).
     * 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60899 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60899/consoleFull)** for PR 13786 at commit [`f2b010e`](https://github.com/apache/spark/commit/f2b010e87aa72d7b9cf1ce2de75dd91023fe4d22).
     * 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60885 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60885/consoleFull)** for PR 13786 at commit [`288cbe1`](https://github.com/apache/spark/commit/288cbe160b2431fe73f09d5b9f315b6c17ead802).
     * 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Hi, @Div333 . 
    @mhnatiuk is right.
    For the binary and document, Spark 2.0 is very close to release. You had better wait. :)


---
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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67801232
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @name pivot
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' df <- createDataFrame(data.frame(
    +#'     earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +#'     course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +#'     year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +#' ))
    +#' collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", "R"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    --- End diff --
    
    Thank you. I agree with you. That would be much better.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Thank you, @shivaram !


---
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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67796883
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @family agg
    --- End diff --
    
    yes


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Thank you always, @felixcheung !


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    Hi, @shivaram , @felixcheung .
    This is the up-to-date `pivot` PR.


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60885 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60885/consoleFull)** for PR 13786 at commit [`288cbe1`](https://github.com/apache/spark/commit/288cbe160b2431fe73f09d5b9f315b6c17ead802).


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60898 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60898/consoleFull)** for PR 13786 at commit [`63ef66b`](https://github.com/apache/spark/commit/63ef66b2709a0b31b3e287065124f297d941a946).


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by mhnatiuk <gi...@git.apache.org>.
Github user mhnatiuk commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    By unpivot, do you mean something like reshape2::melt function?
    Pivot function is included in branch-2.0.0 so you would have to build Spark
    distribution from this branch yourself
    
    2016-06-24 4:25 GMT+02:00 Div333 <no...@github.com>:
    
    > Hello everyone, Thanks a lot for implementing the pivot functionality. I
    > have started using SparkR recently and would like to know if the pivot
    > method is included in the library as I don't find it in the documentation.
    > Also, I am looking to use the unpivot functionality. It would be great if
    > it is included.
    >
    > —
    > You are receiving this because you were mentioned.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/spark/pull/13786#issuecomment-228241166>, or mute
    > the thread
    > <https://github.com/notifications/unsubscribe/ACMWZMcCWQ7P7HS0frScfGwAuIVqz5LGks5qO0A3gaJpZM4I6HCi>
    > .
    >



---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60872 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60872/consoleFull)** for PR 13786 at commit [`54b9dbc`](https://github.com/apache/spark/commit/54b9dbceb988866924ae6c0f2e08c8c98b25f383).
     * This patch **fails R style 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/13786
  
    minor comment, LGTM otherwise. 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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    **[Test build #60878 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60878/consoleFull)** for PR 13786 at commit [`c462296`](https://github.com/apache/spark/commit/c4622960754fb85f073c52232d4e8593ee619d10).
     * 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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67771049
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -1397,6 +1397,26 @@ test_that("group by, agg functions", {
       unlink(jsonPath3)
     })
     
    +test_that("pivot GroupedData column", {
    +  df <- createDataFrame(data.frame(
    +    earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +    course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +    year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +  ))
    +  sum1 <- collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +  sum2 <- collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +  sum3 <- collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    +
    +  correct_answer <- data.frame(
    +    year = c(2013, 2014, 2015, 2016),
    +    Python = c(10000, 15000, 20000, 22000),
    +    R = c(10000, 11000, 12000, 21000)
    +  )
    +  expect_equal(sum1, correct_answer)
    +  expect_equal(sum2, correct_answer)
    +  expect_equal(sum3, correct_answer)
    --- End diff --
    
    Minor: Can we add a test case that fails on the unique check that we have ? We can use `expect_error` for 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 #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786#discussion_r67797243
  
    --- Diff: R/pkg/R/group.R ---
    @@ -129,6 +129,48 @@ methods <- c("avg", "max", "mean", "min", "sum")
     # These are not exposed on GroupedData: "kurtosis", "skewness", "stddev", "stddev_samp", "stddev_pop",
     # "variance", "var_samp", "var_pop"
     
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#'
    +#' Pivot a column of the GroupedData and perform the specified aggregation.
    +#' There are two versions of pivot function: one that requires the caller to specify the list
    +#' of distinct values to pivot on, and one that does not. The latter is more concise but less
    +#' efficient, because Spark needs to first compute the list of distinct values internally.
    +#'
    +#' @param x a GroupedData object
    +#' @param colname A column name
    +#' @param values A value or a list/vector of distinct values for the output columns.
    +#' @return GroupedData object
    +#' @rdname pivot
    +#' @name pivot
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#' df <- createDataFrame(data.frame(
    +#'     earnings = c(10000, 10000, 11000, 15000, 12000, 20000, 21000, 22000),
    +#'     course = c("R", "Python", "R", "Python", "R", "Python", "R", "Python"),
    +#'     year = c(2013, 2013, 2014, 2014, 2015, 2015, 2016, 2016)
    +#' ))
    +#' collect(sum(pivot(groupBy(df, "year"), "course"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", "R"), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", c("Python", "R")), "earnings"))
    +#' collect(sum(pivot(groupBy(df, "year"), "course", list("Python", "R")), "earnings"))
    --- End diff --
    
    nit: I think maybe we should vary the examples a bit? Perhaps to avoid promoting collect() if possible, either leave it at `pivot(....)` or set to a variable `group_sum <- sum(pivot(...))`


---
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 issue #13786: [SPARK-15294][R] Add `pivot` to SparkR

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

    https://github.com/apache/spark/pull/13786
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60878/
    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