MaxGekk commented on a change in pull request #35845:
URL: https://github.com/apache/spark/pull/35845#discussion_r833575499
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala
##########
@@ -2735,6 +2735,29 @@ abstract class CSVSuite
}
}
}
+
+ test("SPARK-38520: Intervals are overflow") {
Review comment:
The issue is not specific to the CSV datasource. Could you move/port
tests to `IntervalUtilsSuite`.
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -352,13 +352,16 @@ object IntervalUtils {
val sign = finalSign(firstSign, secondSign)
unit.toUpperCase(Locale.ROOT) match {
case "DAY" if suffix == null && value.length <= 9 &&
checkTargetType(DT.DAY, DT.DAY) =>
- sign * value.toLong * MICROS_PER_DAY
+ val days = toLongWithRange(dayStr, value, 0, MAX_DAY)
+ sign * days * MICROS_PER_DAY
Review comment:
Could you re-use the existing function which checks arithmetic ops too:
```suggestion
toDTInterval(value, "0", "0", "0", sign)
```
--
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]