Mryange commented on code in PR #18872:
URL: https://github.com/apache/doris/pull/18872#discussion_r1173304080
##########
be/src/vec/runtime/vdatetime_value.cpp:
##########
@@ -1580,10 +1580,10 @@ bool VecDateTimeValue::date_add_interval(const
TimeInterval& interval) {
// This will change month and year information, maybe date.
int64_t months = _year * 12 + _month - 1 + sign * (12 * interval.year
+ interval.month);
_year = months / 12;
- if (_year > 9999) {
+ if (_year < MIN_YEAR || _year > MAX_YEAR) {
return false;
}
- _month = (months % 12) + 1;
+ _month = ((_month + 11 + sign * interval.month + 12) % 12) + 1;
Review Comment:
now update.
In my opinion, if months is less than 0, it should be an invalid value.If we
consider negative numbers as valid values, then the result of months = 5 and
months = -7 will be the same.
--
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]