gotocoding-DB commented on code in PR #48773:
URL: https://github.com/apache/spark/pull/48773#discussion_r1839018299
##########
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:
* ~~But I don't have context here:
https://github.com/apache/spark/pull/48773/files#diff-0ffd087e0d4e1618761a42c91b8712fd469e758f4789ca2fafdefff753fe81d5R507~~
* ~~And I do not have `getContextOrNullCode(ctx)` here:
https://github.com/apache/spark/pull/48773/files#diff-0ffd087e0d4e1618761a42c91b8712fd469e758f4789ca2fafdefff753fe81d5R514-R519~~
~~How to get right context to pass it to makeDayTimeInterval?~~
Ok, I'll add `with SupportQueryContext` to `case class MakeDTInterval`.
--
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]