thswlsqls opened a new pull request, #8767: URL: https://github.com/apache/paimon/pull/8767
### Purpose fix #8764 - `DateTimeUtils.truncate(Timestamp, int)` counted fractional-second digits with `Integer.toString(ts.toLocalDateTime().getNano())`, which strips leading zeros and under-counts fractions below 0.1s. - The short-circuit guard `if (fraction.length() <= precision) return ts;` then wrongly skipped truncation, so a narrowing precision cast (`TimestampToTimestampCastRule`) silently retained sub-precision nanoseconds — e.g. `.000000009`→precision 3 stayed `.000000009` instead of `.000`. - Now pad to 9 digits and count significant digits by stripping trailing zeros, mirroring the sibling `formatTimestamp()` in the same file. ### Tests - Added `DateTimeUtilsTest#testTruncateDropsSubPrecisionFraction` (`.000000009`→p3, `.000123456`→p6 with independent hardcoded expected nanos), `#testTruncateIsIdempotent`, `#testTruncateNoOpAtMaxPrecision`. - `mvn -pl paimon-common -DfailIfNoTests=false clean install` — BUILD SUCCESS (checkstyle + spotless + rat + all paimon-common tests passed), JDK 11. -- 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]
