MaxGekk commented on a change in pull request #26401: [SPARK-29761][SQL] do not 
output leading 'interval' in CalendarInterval.toString
URL: https://github.com/apache/spark/pull/26401#discussion_r342731332
 
 

 ##########
 File path: 
common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java
 ##########
 @@ -101,18 +101,19 @@ public String toString() {
       rest %= MICROS_PER_MINUTE;
       if (rest != 0) {
         String s = BigDecimal.valueOf(rest, 
6).stripTrailingZeros().toPlainString();
-        sb.append(' ').append(s).append(" seconds");
+        sb.append(s).append(" seconds ");
       }
     } else if (months == 0 && days == 0) {
-      sb.append(" 0 microseconds");
+      sb.append("0 microseconds ");
     }
 
+    sb.setLength(sb.length() - 1);
     return sb.toString();
   }
 
   private void appendUnit(StringBuilder sb, long value, String unit) {
 
 Review comment:
   If we always add "s " to the end of units, maybe just pass units with "s "? 
I mean `"year "`, `"month "`, `"day "` ...

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

Reply via email to