cloud-fan commented on a change in pull request #32266:
URL: https://github.com/apache/spark/pull/32266#discussion_r622797208
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -127,20 +123,21 @@ object IntervalUtils {
require(input != null, "Interval year-month string must be not null")
input.trim match {
case yearMonthPattern("-", yearStr, monthStr) =>
- toYMInterval(yearStr, monthStr, -1)
+ new CalendarInterval(toYMInterval(yearStr, monthStr, -1), 0, 0)
case yearMonthPattern(_, yearStr, monthStr) =>
- toYMInterval(yearStr, monthStr, 1)
+ new CalendarInterval(toYMInterval(yearStr, monthStr, 1), 0, 0)
case _ =>
throw new IllegalArgumentException(
s"Interval string does not match year-month format of 'y-m': $input")
}
}
- def toYMInterval(yearStr: String, monthStr: String, sign: Int):
CalendarInterval = {
+ def toYMInterval(yearStr: String, monthStr: String, sign: Int): Int = {
try {
val years = toLongWithRange(YEAR, yearStr, 0, Integer.MAX_VALUE /
MONTHS_PER_YEAR)
val totalMonths = sign * (years * MONTHS_PER_YEAR +
toLongWithRange(MONTH, monthStr, 0, 11))
- new CalendarInterval(Math.toIntExact(totalMonths), 0, 0)
+// new CalendarInterval(Math.toIntExact(totalMonths), 0, 0)
Review comment:
remove this?
--
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]