vranes commented on code in PR #59239:
URL: https://github.com/apache/spark/pull/59239#discussion_r4229023192
##########
sql/core/src/test/scala/org/apache/spark/sql/BinBySuite.scala:
##########
@@ -428,6 +456,48 @@ class BinBySuite extends QueryTest with SharedSparkSession
{
}
}
+ test("BIN BY raises DATETIME_OVERFLOW when the next bin index is not
representable") {
+ val maxTimestamp = DateTimeUtils.microsToLocalDateTime(Long.MaxValue)
+ checkBinByDatetimeOverflow(
+ rangeStart = maxTimestamp,
+ rangeEnd = maxTimestamp,
+ binWidthSql = "INTERVAL '0.000001' SECOND",
+ originSql = "TIMESTAMP_NTZ '1970-01-01 00:00:00'")
+ }
+
+ test("BIN BY raises DATETIME_OVERFLOW when the range duration is not
representable") {
+ checkBinByDatetimeOverflow(
+ rangeStart = DateTimeUtils.microsToLocalDateTime(Long.MinValue),
+ rangeEnd = DateTimeUtils.microsToLocalDateTime(Long.MaxValue),
+ binWidthSql = "INTERVAL '1' SECOND",
+ originSql = "TIMESTAMP_NTZ '1970-01-01 00:00:00'")
+ }
+
+ test("BIN BY raises DATETIME_OVERFLOW when locating a zero-length range bin
overflows") {
Review Comment:
Done, added a multi-day case where k = 0 and origin + width overflows in
instantToMicros. Thanks!
--
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]