Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/21611#discussion_r200585475
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/DatasetAggregatorSuite.scala ---
@@ -333,4 +369,29 @@ class DatasetAggregatorSuite extends QueryTest with
SharedSQLContext {
df.groupBy($"i").agg(VeryComplexResultAgg.toColumn),
Row(1, Row(Row(1, "a"), Row(1, "a"))) :: Row(2, Row(Row(2, "bc"),
Row(2, "bc"))) :: Nil)
}
+
+ test("SPARK-24569: Aggregator with output type Option[Boolean] creates
column of type Row") {
+ val df = Seq(
+ OptionBooleanData("bob", Some(true)),
+ OptionBooleanData("bob", Some(false)),
+ OptionBooleanData("bob", None)).toDF()
+ val group = df
+ .groupBy("name")
+ .agg(OptionBooleanAggregator("isGood").toColumn.alias("isGood"))
+ assert(df.schema == group.schema)
+ checkAnswer(group, Row("bob", true) :: Nil)
+ checkDataset(group.as[OptionBooleanData], OptionBooleanData("bob",
Some(true)))
+ }
+
+ test("SPARK-24569: groupByKey with Aggregator of output type
Option[Boolean]") {
+ val df = Seq(
--- End diff --
can we create a ds not df here?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]