You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "lide-reed (via GitHub)" <gi...@apache.org> on 2023/11/02 12:07:50 UTC

Re: [PR] [fix](function) the result is incorrect because of the datetimev2 type [doris]

lide-reed commented on code in PR #26154:
URL: https://github.com/apache/doris/pull/26154#discussion_r1380005147


##########
be/src/vec/runtime/vdatetime_value.h:
##########
@@ -1316,8 +1316,8 @@ int64_t datetime_diff(const DateV2Value<T0>& ts_value1, const DateV2Value<T1>& t
         int month = (ts_value2.year() - ts_value1.year()) * 12 +
                     (ts_value2.month() - ts_value1.month());
         if constexpr (std::is_same_v<T0, T1>) {
-            int shift_bits = DateV2Value<T0>::is_datetime ? DATETIMEV2_YEAR_WIDTH + 5
-                                                          : DATEV2_YEAR_WIDTH + 5;
+            int shift_bits = DateV2Value<T0>::is_datetime ? DATETIMEV2_YEAR_WIDTH + 4
+                                                          : DATEV2_YEAR_WIDTH + 4;

Review Comment:
   Can you define a const variable to show its real meaning  for the magic 4?  



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org