yaooqinn commented on a change in pull request #26572:
[SPARK-29870][SQL][FOLLOW-UP] Keep CalendarInterval's toString
URL: https://github.com/apache/spark/pull/26572#discussion_r347278921
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -332,30 +332,7 @@ object IntervalUtils {
fromDoubles(interval.months / num, interval.days / num,
interval.microseconds / num)
}
- def toMultiUnitsString(interval: CalendarInterval): String = {
- if (interval.months == 0 && interval.days == 0 && interval.microseconds ==
0) {
- return "0 seconds"
- }
- val sb = new StringBuilder
- if (interval.months != 0) {
- appendUnit(sb, interval.months / 12, "years")
- appendUnit(sb, interval.months % 12, "months")
- }
- appendUnit(sb, interval.days, "days")
- if (interval.microseconds != 0) {
- var rest = interval.microseconds
- appendUnit(sb, rest / MICROS_PER_HOUR, "hours")
- rest %= MICROS_PER_HOUR
- appendUnit(sb, rest / MICROS_PER_MINUTE, "minutes")
- rest %= MICROS_PER_MINUTE
- if (rest != 0) {
- val s = BigDecimal.valueOf(rest, 6).stripTrailingZeros.toPlainString
- sb.append(s).append(" seconds ")
- }
- }
- sb.setLength(sb.length - 1)
- sb.toString
- }
+ def toMultiUnitsString(interval: CalendarInterval): String =
interval.toString
private def appendUnit(sb: StringBuilder, value: Long, unit: String): Unit =
{
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]