Github user koertkuipers commented on the issue:

    https://github.com/apache/spark/pull/13512
  
    @cloud-fan from the (added) unit tests:
    ```
    val df2 = Seq("a" -> 1, "a" -> 3, "b" -> 3).toDF("i", "j")
    checkAnswer(df2.groupBy("i").agg(ComplexResultAgg.toColumn),
      Row("a", Row(2, 4)) :: Row("b", Row(1, 3)) :: Nil)
    ```
    this shows how the underlying type is Row (with a schema consisting of 
Strings and Ints), and it gets converted to the input type of the Aggregator 
which is (String, Long), so this involves both conversion and upcast.
    
    and:
    ```
    val df3 = Seq(("a", "x", 1), ("a", "y", 3), ("b", "x", 3)).toDF("i", "j", 
"k")
    checkAnswer(df3.groupBy("i").agg(ComplexResultAgg("i", "k")),
      Row("a", Row(2, 4)) :: Row("b", Row(1, 3)) :: Nil)
    ```
    this is similar to the previous example but i also select the columns i 
want the Aggregator to operate on (namely columns "i" and "k")


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to