BiteTheDDDDt commented on code in PR #16970: URL: https://github.com/apache/doris/pull/16970#discussion_r1113179687
########## be/src/vec/runtime/vdatetime_value.cpp: ########## @@ -2553,17 +2553,25 @@ bool DateV2Value<T>::date_add_interval(const TimeInterval& interval, DateV2Value int sign = interval.is_neg ? -1 : 1; - if constexpr ((unit == SECOND) || (unit == MINUTE) || (unit == HOUR) || + if constexpr ((unit == MICROSECOND) || (unit == SECOND) || (unit == MINUTE) || (unit == HOUR) || (unit == SECOND_MICROSECOND) || (unit == MINUTE_MICROSECOND) || (unit == MINUTE_SECOND) || (unit == HOUR_MICROSECOND) || (unit == HOUR_SECOND) || (unit == HOUR_MINUTE) || (unit == DAY_MICROSECOND) || (unit == DAY_SECOND) || (unit == DAY_MINUTE) || (unit == DAY_HOUR) || (unit == DAY) || (unit == WEEK)) { // This may change the day information + int64_t microseconds = this->microsecond() + sign * interval.microsecond; + int64_t extra_second = microseconds / 1000000L; + microseconds %= 1000000L; Review Comment: better define 1000000 to a constexpr value as a common constant. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org