gengliangwang edited a comment on pull request #32814:
URL: https://github.com/apache/spark/pull/32814#issuecomment-856857466
> Does instantToMicros overflow on the values?
@MaxGekk Yes. The Long.MinValue case contains negative seconds and positive
nanoseconds. Thus it overflows when we try to convert it back.
```
scala> import org.apache.spark.sql.catalyst.util.DateTimeUtils._
import org.apache.spark.sql.catalyst.util.DateTimeUtils._
scala> instantToMicros(microsToInstant(Long.MinValue))
java.lang.ArithmeticException: long overflow
at java.lang.Math.multiplyExact(Math.java:892)
at
org.apache.spark.sql.catalyst.util.DateTimeUtils$.instantToMicros(DateTimeUtils.scala:389)
... 49 elided
scala> microsToInstant(Long.MinValue).getNano
res10: Int = 224192000
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]