MaxGekk commented on a change in pull request #32988:
URL: https://github.com/apache/spark/pull/32988#discussion_r655156536
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
##########
@@ -1115,34 +1115,47 @@ class DataFrameAggregateSuite extends QueryTest
}
test("SPARK-34716: Support ANSI SQL intervals by the aggregate function
`sum`") {
- val df = Seq((1, Period.ofMonths(10), Duration.ofDays(10)),
- (2, Period.ofMonths(1), Duration.ofDays(1)),
- (2, null, null),
- (3, Period.ofMonths(-3), Duration.ofDays(-6)),
- (3, Period.ofMonths(21), Duration.ofDays(-5)))
- .toDF("class", "year-month", "day-time")
+ val df = Seq(
+ (1, Period.ofMonths(10), Period.ofYears(8), Period.ofMonths(10),
Duration.ofDays(10)),
+ (2, Period.ofMonths(1), Period.ofYears(1), Period.ofMonths(1),
Duration.ofDays(1)),
+ (2, null, null, null, null),
+ (3, Period.ofMonths(-3), Period.ofYears(-12), Period.ofMonths(-3),
Duration.ofDays(-6)),
+ (3, Period.ofMonths(21), Period.ofYears(30), Period.ofMonths(5),
Duration.ofDays(-5)))
+ .toDF("class", "year-month", "year", "month", "day-time")
+ .select(
+ $"class",
+ $"year-month",
+ $"year" cast YearMonthIntervalType(0, 0) as "year",
Review comment:
Could you use `YEAR` instead of `0`
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
##########
@@ -1115,34 +1115,47 @@ class DataFrameAggregateSuite extends QueryTest
}
test("SPARK-34716: Support ANSI SQL intervals by the aggregate function
`sum`") {
- val df = Seq((1, Period.ofMonths(10), Duration.ofDays(10)),
- (2, Period.ofMonths(1), Duration.ofDays(1)),
- (2, null, null),
- (3, Period.ofMonths(-3), Duration.ofDays(-6)),
- (3, Period.ofMonths(21), Duration.ofDays(-5)))
- .toDF("class", "year-month", "day-time")
+ val df = Seq(
+ (1, Period.ofMonths(10), Period.ofYears(8), Period.ofMonths(10),
Duration.ofDays(10)),
+ (2, Period.ofMonths(1), Period.ofYears(1), Period.ofMonths(1),
Duration.ofDays(1)),
+ (2, null, null, null, null),
+ (3, Period.ofMonths(-3), Period.ofYears(-12), Period.ofMonths(-3),
Duration.ofDays(-6)),
+ (3, Period.ofMonths(21), Period.ofYears(30), Period.ofMonths(5),
Duration.ofDays(-5)))
+ .toDF("class", "year-month", "year", "month", "day-time")
+ .select(
+ $"class",
+ $"year-month",
+ $"year" cast YearMonthIntervalType(0, 0) as "year",
+ $"month" cast YearMonthIntervalType(1, 1) as "month",
Review comment:
Use `MONTH` instead of `1`.
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]