You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/09 10:48:34 UTC
[GitHub] [spark] MaxGekk commented on a change in pull request #32839: [SPARK-35679][SQL] instantToMicros overflow
MaxGekk commented on a change in pull request #32839:
URL: https://github.com/apache/spark/pull/32839#discussion_r648186390
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
##########
@@ -385,9 +385,15 @@ object DateTimeUtils {
* microseconds where microsecond 0 is 1970-01-01 00:00:00Z.
*/
def instantToMicros(instant: Instant): Long = {
- val us = Math.multiplyExact(instant.getEpochSecond, MICROS_PER_SECOND)
- val result = Math.addExact(us, NANOSECONDS.toMicros(instant.getNano))
- result
+ if (instant.getEpochSecond < 0) {
Review comment:
@dgd-contributor Could you follow the approach from:
https://github.com/apache/spark/blob/2c8ced95905b8a9f7b98c4913a385d25da455e7a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala#L872-L885
and handle especially just small range. So, perf impact should be smaller.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org