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

    https://github.com/apache/spark/pull/18740#discussion_r129906375
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala 
---
    @@ -1304,6 +1304,15 @@ class DatasetSuite extends QueryTest with 
SharedSQLContext {
           assert(rlike3.count() == 0)
         }
       }
    +
    +  test("SPARK-21538: Attribute resolution inconsistency in Dataset API") {
    +    val df = spark.range(1).withColumnRenamed("id", "x")
    +    checkAnswer(df.sort(col("id")), df.sort("id"))
    +    checkAnswer(df.sort($"id"), df.sort("id"))
    +    checkAnswer(df.sort('id), df.sort("id"))
    +    checkAnswer(df.orderBy('id), df.sort("id"))
    +    checkAnswer(df.orderBy("id"), df.sort("id"))
    --- End diff --
    
    Since it sounds like you are very interested in Spark open source 
contribution, let me explain how we write the test cases. Normally, we do not 
want to duplicate the codes and also want to verify the results. Thus, maybe 
you can change the code like
    
    ```Scala
        val df = spark.range(3).withColumnRenamed("id", "x")
        val expected = Row(0) :: Row(1) :: Row (2) :: Nil
        checkAnswer(df.sort("id"), expected)
        checkAnswer(df.sort(col("id")), expected)
        checkAnswer(df.sort($"id"), expected)
        checkAnswer(df.sort('id), expected)
        checkAnswer(df.orderBy('id), expected)
        checkAnswer(df.orderBy("id"), expected)
    ```


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