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

    https://github.com/apache/spark/pull/369#discussion_r12554718
  
    --- Diff: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala ---
    @@ -541,6 +543,46 @@ class RDDSuite extends FunSuite with 
SharedSparkContext {
         }
       }
     
    +  test("sortByKey") {
    +    val data = sc.parallelize(Seq("5|50|A","4|60|C", "6|40|B"))
    +
    +    val col1 = Array("4|60|C", "5|50|A", "6|40|B")
    +    val col2 = Array("6|40|B", "5|50|A", "4|60|C")
    +    val col3 = Array("5|50|A", "6|40|B", "4|60|C")
    +
    +    assert(data.sortBy(_.split("\\|")(0)).collect === col1)
    +    assert(data.sortBy(_.split("\\|")(1)).collect === col2)
    +    assert(data.sortBy(_.split("\\|")(2)).collect === col3)
    +  }
    +
    +  test("sortByKey ascending parameter") {
    +    val data = sc.parallelize(Seq("5|50|A","4|60|C", "6|40|B"))
    +
    +    val asc = Array("4|60|C", "5|50|A", "6|40|B")
    +    val desc = Array("6|40|B", "5|50|A", "4|60|C")
    +
    +    assert(data.sortBy(_.split("\\|")(0), true).collect === asc)
    +    assert(data.sortBy(_.split("\\|")(0), false).collect === desc)
    +  }
    +
    +  // issues with serialization of Ordering in the test
    +  ignore("sortByKey with explicit ordering") {
    +    val data = sc.parallelize(Seq("Bob|Smith|50", "Jane|Smith|40", 
"Thomas|Williams|30", "Karen|Williams|60"))
    --- End diff --
    
    a few of the lines in this function exceed 100 chars


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

Reply via email to