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

    https://github.com/apache/spark/pull/7945#discussion_r36350771
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/DataFrameStatSuite.scala ---
    @@ -131,6 +131,24 @@ class DataFrameStatSuite extends QueryTest {
         items2.getSeq[Double](0) should contain (-1.0)
       }
     
    +  test("Frequent Items 2") {
    +    val rows = sqlCtx.sparkContext.parallelize(Seq.empty[Int], 4)
    +    // this is a regression test, where when merging partitions, we 
omitted values with higher
    +    // counts than those that existed in the map when the map was full. 
This test should also fail
    +    // if anything like SPARK-9614 is observed once again
    +    val df = rows.mapPartitionsWithIndex { (idx, iter) =>
    +      if (idx == 3) {
    +        Iterator.tabulate(5)(_ => "3")
    +      } else {
    +        Iterator.tabulate(5)(i => (i * (idx + 1)).toString)
    +      }
    +    }.toDF("a")
    --- End diff --
    
    Took me some time to understand the test data generation code. Maybe it is 
straightforward to write down the sequence directly:
    
    ~~~scala
    val rows = sc.parallelize(Array(Array(0, 1, 2, 3, 4), ..., Array(3, 3, 3, 
3, 3)), 4).map((_.toString))
    ~~~


---
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