mihailom-db commented on code in PR #48773:
URL: https://github.com/apache/spark/pull/48773#discussion_r1839045807
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalMathUtils.scala:
##########
@@ -35,12 +35,17 @@ object IntervalMathUtils {
def negateExact(a: Long): Long = withOverflow(Math.negateExact(a))
- private def withOverflow[A](f: => A, hint: String = ""): A = {
+ private def withOverflow[A](f: => A, suggestedFunc: String = ""): A = {
try {
f
} catch {
- case e: ArithmeticException =>
- throw
QueryExecutionErrors.intervalArithmeticOverflowError(e.getMessage, hint, null)
+ case _: ArithmeticException =>
+ if (suggestedFunc.isEmpty) {
+ throw
QueryExecutionErrors.withoutSuggestionIntervalArithmeticOverflowError(
+ context = null)
+ }
+ throw
QueryExecutionErrors.withSuggestionIntervalArithmeticOverflowError(
+ suggestedFunc, context = null)
Review Comment:
```suggestion
case _: ArithmeticException if suggestedFunc.isEmpty =>
throw
QueryExecutionErrors.withoutSuggestionIntervalArithmeticOverflowError(
context = null)
case _: ArithmeticException =>
throw
QueryExecutionErrors.withSuggestionIntervalArithmeticOverflowError(
suggestedFunc, context = null)
```
--
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]