stevomitric commented on code in PR #60130:
URL: https://github.com/apache/spark/pull/60130#discussion_r4514547475
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala:
##########
@@ -575,7 +591,9 @@ object DateTimeUtils extends SparkDateTimeUtils {
*/
def truncDate(days: Int, level: Int): Int = {
level match {
- case TRUNC_TO_WEEK => getNextDateForDayOfWeek(days - 7, MONDAY)
+ // `days - 7L` so the subtraction does not wrap. Near the minimum DATE,
trunc still wraps
+ // (this `.toInt`, and the Int arithmetic of the other levels); that is
a trunc follow-up.
+ case TRUNC_TO_WEEK => nextDateForDayOfWeek(days - 7L, MONDAY).toInt
Review Comment:
done
--
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]