cloud-fan commented on a change in pull request #32070:
URL: https://github.com/apache/spark/pull/32070#discussion_r608421184
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -867,19 +867,20 @@ object IntervalUtils {
// Especial handling of minimum `Long` value because negate op
overflows `Long`.
// seconds = 106751991 * (24 * 60 * 60) + 4 * 60 * 60 + 54 =
9223372036854
// microseconds = -9223372036854000000L-775808 == Long.MinValue
- return "INTERVAL '-106751991 4:0:54.775808' DAY TO SECOND"
+ return "INTERVAL '-106751991 04:00:54.775808' DAY TO SECOND"
} else {
sign = "-"
rest = -rest
}
}
val seconds = rest % MICROS_PER_MINUTE
- val secondStr = java.math.BigDecimal.valueOf(seconds,
6).stripTrailingZeros().toPlainString()
rest /= MICROS_PER_MINUTE
val minutes = rest % MINUTES_PER_HOUR
rest /= MINUTES_PER_HOUR
val hours = rest % HOURS_PER_DAY
val days = rest / HOURS_PER_DAY
- s"INTERVAL '$sign$days $hours:$minutes:$secondStr' DAY TO SECOND"
+ val leadSecZero = if (seconds < 10000000) "0" else ""
Review comment:
nit: use MICROS_PER_SECONDS?
--
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]