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

    https://github.com/apache/spark/pull/7945#discussion_r36350774
  
    --- 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")
    +    val results = df.stat.freqItems(Array("a"), 0.25)
    +    val items = results.collect().head.getSeq[String](0)
    +    items should contain ("3")
    --- End diff --
    
    minor: I checked `DataFrameSuite` and didn't see `should` usage. 
`assert(....contains(...))` is more common, just to be consistent with code in 
other places.


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