manner commented on code in PR #29080:
URL: https://github.com/apache/flink/pull/29080#discussion_r3934971315


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -1725,7 +1725,8 @@ private static void int4(StringBuilder buf, int i) {
     }
 
     public static TimestampData truncate(TimestampData ts, int precision) {
-        String fraction = Integer.toString(ts.toLocalDateTime().getNano());
+        // Zero-pad to nine digits so leading zeros are not dropped and the 
precision understated.
+        String fraction = String.format("%09d", 
ts.toLocalDateTime().getNano());

Review Comment:
   ```java
   String.format("%09d", ts.toLocalDateTime().getNano()).length()
   ```
   is always `9` anyways, so this can be simplified, which removes the whole 
String usage.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to