You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/13 02:14:19 UTC

[GitHub] [spark] beliefer commented on a change in pull request #32107: [SPARK-34716][SQL] Support ANSI SQL intervals by the aggregate function `sum`

beliefer commented on a change in pull request #32107:
URL: https://github.com/apache/spark/pull/32107#discussion_r612079585



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
##########
@@ -1110,6 +1112,14 @@ class DataFrameAggregateSuite extends QueryTest
     val e = intercept[AnalysisException](arrayDF.groupBy(struct($"col.a")).count())
     assert(e.message.contains("requires integral type"))
   }
+
+  test("SPARK-34716: Support ANSI SQL intervals by the aggregate function `sum`") {
+    val df = Seq((Period.ofMonths(10), Duration.ofDays(10)),
+      (Period.ofMonths(1), Duration.ofDays(1)))
+      .toDF("year-month", "day-time")
+    val sumDF = df.select(sum($"year-month"), sum($"day-time"))
+    checkAnswer(sumDF, Row(Period.ofMonths(11), Duration.ofDays(11)))

Review comment:
       OK




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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