Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12836#discussion_r61968540
  
    --- Diff: R/pkg/inst/tests/testthat/test_sparkSQL.R ---
    @@ -2083,6 +2083,46 @@ test_that("dapply() on a DataFrame", {
       expect_identical(expected, result)
     })
     
    +test_that("gapply() on a DataFrame", {
    +  df <- createDataFrame (
    +    sqlContext,
    +    list(list(1L, 1, "1", 0.1), list(1L, 2, "2", 0.2), list(3L, 3, "3", 
0.3)),
    +    c("a", "b", "c", "d"))
    +  expected <- collect(df)
    +  df1 <- gapply(df, function(x) { x }, schema(df), df$"a")
    +  actual <- collect(df1)
    +  expect_identical(actual, expected)
    +
    +  # Computes the sum of second column by grouping on the first column and 
checks
    +  # if the sum is larger than 2
    +  schema <- structType(structField("a", "integer"), structField("e", 
"boolean"))
    +  df2 <- gapply(
    +    df,
    +    function(x) {
    +      y <- data.frame(x$a[1], sum(x$b) > 2)
    --- End diff --
    
    Does this require that `x` is order by `a`?
    
    If not, should gapply() could be done by   dapply(repartition(df, "a"), f) ?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to