MaxGekk commented on code in PR #48773:
URL: https://github.com/apache/spark/pull/48773#discussion_r1838674331


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala:
##########
@@ -785,10 +785,15 @@ object IntervalUtils extends SparkIntervalUtils {
       secs: Decimal): Long = {
     assert(secs.scale == 6, "Seconds fractional must have 6 digits for 
microseconds")
     var micros = secs.toUnscaledLong
-    micros = Math.addExact(micros, Math.multiplyExact(days, MICROS_PER_DAY))
-    micros = Math.addExact(micros, Math.multiplyExact(hours, MICROS_PER_HOUR))
-    micros = Math.addExact(micros, Math.multiplyExact(mins, MICROS_PER_MINUTE))
-    micros
+    try {
+      micros = Math.addExact(micros, Math.multiplyExact(days, MICROS_PER_DAY))
+      micros = Math.addExact(micros, Math.multiplyExact(hours, 
MICROS_PER_HOUR))
+      micros = Math.addExact(micros, Math.multiplyExact(mins, 
MICROS_PER_MINUTE))
+      micros
+    } catch {
+      case _: ArithmeticException =>
+        throw 
QueryExecutionErrors.withoutSuggestionIntervalArithmeticOverflowError()

Review Comment:
   You just need to pass the context from `MakeDTInterval` to 
`makeDayTimeInterval` in the same way as for `MakeYMInterval`.



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


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

Reply via email to