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/06/21 16:30:05 UTC

[GitHub] [spark] sarutak commented on a change in pull request #32999: [SPARK-35727][SQL] Return INTERVAL DAY from dates subtraction

sarutak commented on a change in pull request #32999:
URL: https://github.com/apache/spark/pull/32999#discussion_r655536070



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/ColumnExpressionSuite.scala
##########
@@ -2790,7 +2790,9 @@ class ColumnExpressionSuite extends QueryTest with SharedSparkSession {
           ).foreach { case (end, start) =>
             val df = Seq((end, start)).toDF("end", "start")
             val daysBetween = Duration.ofDays(ChronoUnit.DAYS.between(start, end))
-            checkAnswer(df.select($"end" - $"start"), Row(daysBetween))
+            val r = df.select($"end" - $"start").toDF("diff")
+            checkAnswer(r, Row(daysBetween))
+            assert(r.schema === new StructType().add("diff", DayTimeIntervalType(0, 0)))

Review comment:
       @Peng-Lei This change seems to include the change not only for `Date - Date` but also `Date + Interval` and `Interval + Date`. If you'd like to include them, could you add tests for them too?




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