ODriscollBoys opened a new pull request, #10485: URL: https://github.com/apache/paimon/pull/10485
### Purpose The temporal computed-column functions (`year`, `month`, `day`, `hour`, `minute`, `second` and `date_format`) accept an epoch number with a precision of 0, 3, 6 or 9. For microseconds and nanoseconds, `Expression.TemporalExpressionBase` split the value into milliseconds and nano-of-millisecond with `/` and `%`, which round toward zero. Values before 1970 are negative, so the remainder was negative and `Timestamp.fromEpochMillis` threw an `IllegalArgumentException`, which fails the whole synchronization job. For example, `date_format(ts, yyyy-MM-dd HH:mm:ss.SSSSSS, 6)` threw for `ts = -1` (`1969-12-31 23:59:59.999999`). This uses `Math.floorDiv` and `Math.floorMod`, so the nano-of-millisecond is always in `[0, 999999]`. This matches what `BinaryStringUtils` already does when it casts an epoch number to a timestamp. Values after the epoch, and whole milliseconds before it, are unchanged. ### Tests `ComputedColumnUtilsTest#testTemporalFunctionsOnPreEpochNumericValues` covers `date_format`, `year` and `second` with precision 6 and 9 for pre-epoch values, whole milliseconds before the epoch and values after it. It throws `IllegalArgumentException` without this change. `ComputedColumnUtilsTest` and `TruncateComputerTest` pass. -- 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]
