Github user ggupta81 commented on the pull request:

    https://github.com/apache/spark/pull/7928#issuecomment-129711909
  
    @yhuai How to attach a testcase. I could not find the instructions on:
    
https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark#ContributingtoSpark-PullRequest
 
    
    Here is the command line script to test:
    
    import sqlContext.implicits._
    import org.apache.spark.sql.Row;
    import org.apache.spark.sql.types.{StructType,StructField,StringType};
    val schemaString = "name age"
    val schema = StructType( schemaString.split(" ").map(fieldName => 
StructField(fieldName, StringType, true)))
    val rdd = sc.parallelize(List( Row("Micheal","31"), Row("Micheal", "30"), 
Row("Micheal", "28"), Row("Micheal", "32"), Row("Andy", "30"), Row("Andy", 
"31") , Row("Andy", "27"), Row("Justin", "19")), 1)
    val df = sqlContext.createDataFrame(rdd, schema)
    df.cache
    df.registerTempTable("df")
    sqlContext.sql("SELECT name,last(age) FROM df GROUP BY name").show()
    
    The result is:
    +-------+--+
    |   name|c1|
    +-------+--+
    |   Andy|19|
    | Justin|19|
    |Micheal|19|
    +-------+--+
    
    whereas it should be:
    +-------+--+
    |   name|c1|
    +-------+--+
    |   Andy|27|
    | Justin|19|
    |Micheal|32|
    +-------+--+



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