dongjoon-hyun commented on a change in pull request #25220: [SPARK-28459][SQL] 
Add `make_timestamp` function
URL: https://github.com/apache/spark/pull/25220#discussion_r308015568
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
 ##########
 @@ -1742,13 +1742,18 @@ case class MakeTimestamp(
       val seconds = secAndNanos.toInt
       val nanos = ((secAndNanos - seconds) * NANOS_PER_SECOND).toInt
       val ldt = if (seconds == 60) {
-        LocalDateTime.of(year, month, day, hour, min, 0, nanos).plusMinutes(1)
+        if (nanos == 0) {
+          // This case of sec = 60 and nanos = 0 is supported for 
compatibility with PostgreSQL
+          LocalDateTime.of(year, month, day, hour, min, 0, 0).plusMinutes(1)
+        } else {
+          throw new DateTimeException("The fraction of sec must be zero. Valid 
range is [0, 60].")
 
 Review comment:
   Ur, not exception. I mean `null` literally.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to