Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/8314#discussion_r44066760
--- Diff: R/pkg/inst/tests/test_sparkSQL.R ---
@@ -1458,8 +1458,8 @@ test_that("sampleBy() on a DataFrame", {
fractions <- list("0" = 0.1, "1" = 0.2)
sample <- sampleBy(df, "key", fractions, 0)
result <- collect(orderBy(count(groupBy(sample, "key")), "key"))
- expect_identical(as.list(result[1, ]), list(key = "0", count = 2))
- expect_identical(as.list(result[2, ]), list(key = "1", count = 10))
+ expect_identical(as.list(result[1, ]), list(key = "0", count = 3))
+ expect_identical(as.list(result[2, ]), list(key = "1", count = 7))
--- End diff --
this one really confused me ... I thought I could figure out what the right
values should be by running the equivalent thing in scala, but I got totally
different answers.
```scala
case class Data(val key: String)
val data = (0 to 99).map{x => Data((x % 3).toString)}
val dataDF = sqlContext.createDataFrame(data)
scala> dataDF.stat.sampleBy("key", Map("0" -> 0.1, "1" -> 0.2),
0).groupBy("key").count().show()
+---+-----+
|key|count|
+---+-----+
| 0| 5|
| 1| 5|
+---+-----+
```
but whatever, these vals work :/
---
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]