This is an automated email from the ASF dual-hosted git repository.

gabriellee pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new bce60e9fc06 [branch-1.2](AggregationNode) fixed a bug that needed to 
be released if data had null keys (#26493)
bce60e9fc06 is described below

commit bce60e9fc060de88f73f4cac90b21a9343a3f7aa
Author: lw112 <[email protected]>
AuthorDate: Wed Nov 8 13:55:44 2023 +0800

    [branch-1.2](AggregationNode) fixed a bug that needed to be released if 
data had null keys (#26493)
---
 be/src/vec/exec/vaggregation_node.cpp |  4 ++++
 be/src/vec/runtime/vdatetime_value.h  | 17 +++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/be/src/vec/exec/vaggregation_node.cpp 
b/be/src/vec/exec/vaggregation_node.cpp
index 42a5d67f9dc..67924a61b63 100644
--- a/be/src/vec/exec/vaggregation_node.cpp
+++ b/be/src/vec/exec/vaggregation_node.cpp
@@ -1343,6 +1343,10 @@ void AggregationNode::_close_with_serialized_key() {
                         mapped = nullptr;
                     }
                 });
+
+                if (data.has_null_key_data()) {
+                    _destroy_agg_status(data.get_null_key_data());
+                }
             },
             _agg_data->_aggregated_method_variant);
     release_tracker();
diff --git a/be/src/vec/runtime/vdatetime_value.h 
b/be/src/vec/runtime/vdatetime_value.h
index 0080533d3c9..4f5bb4d4375 100644
--- a/be/src/vec/runtime/vdatetime_value.h
+++ b/be/src/vec/runtime/vdatetime_value.h
@@ -1317,8 +1317,9 @@ 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 + DATETIMEV2_MONTH_WIDTH
-                                                          : DATEV2_YEAR_WIDTH 
+ DATETIMEV2_MONTH_WIDTH;
+            int shift_bits = DateV2Value<T0>::is_datetime
+                                     ? DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH
+                                     : DATEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH;
             decltype(ts_value2.to_date_int_val()) minus_one = -1;
             if (month > 0) {
                 month -= ((ts_value2.to_date_int_val() & (minus_one >> 
shift_bits)) <
@@ -1332,20 +1333,24 @@ int64_t datetime_diff(const DateV2Value<T0>& ts_value1, 
const DateV2Value<T1>& t
             if (month > 0) {
                 month -= ((ts_value2.to_date_int_val() &
                            (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))) <
-                          (ts1_int_value & (uint64_minus_one >> 
(DATETIMEV2_YEAR_WIDTH + DATETIMEV2_MONTH_WIDTH))));
+                          (ts1_int_value &
+                           (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))));
             } else if (month < 0) {
                 month += ((ts_value2.to_date_int_val() &
                            (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))) >
-                          (ts1_int_value & (uint64_minus_one >> 
(DATETIMEV2_YEAR_WIDTH + DATETIMEV2_MONTH_WIDTH))));
+                          (ts1_int_value &
+                           (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))));
             }
         } else {
             auto ts2_int_value = ((uint64_t)ts_value2.to_date_int_val()) << 
TIME_PART_LENGTH;
             if (month > 0) {
-                month -= ((ts2_int_value & (uint64_minus_one >> 
(DATETIMEV2_YEAR_WIDTH + DATETIMEV2_MONTH_WIDTH))) <
+                month -= ((ts2_int_value &
+                           (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))) <
                           (ts_value1.to_date_int_val() &
                            (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))));
             } else if (month < 0) {
-                month += ((ts2_int_value & (uint64_minus_one >> 
(DATETIMEV2_YEAR_WIDTH + DATETIMEV2_MONTH_WIDTH))) >
+                month += ((ts2_int_value &
+                           (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))) >
                           (ts_value1.to_date_int_val() &
                            (uint64_minus_one >> (DATETIMEV2_YEAR_WIDTH + 
DATETIMEV2_MONTH_WIDTH))));
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to