BiteTheDDDDt commented on code in PR #16970:
URL: https://github.com/apache/doris/pull/16970#discussion_r1113180943
##########
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:
here can use microseconds-=extra_second*1000000, it is more fast than mod
operator
--
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]