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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 606ce4ed386 [Bug](compatibility) fix percentile function coredump when 
upgrade (#39336)
606ce4ed386 is described below

commit 606ce4ed386e7097dfc96b6294928d6a3cbda67c
Author: zhangstar333 <[email protected]>
AuthorDate: Wed Aug 14 16:51:13 2024 +0800

    [Bug](compatibility) fix percentile function coredump when upgrade (#39336)
    
    ## Proposed changes
    
    from master : https://github.com/apache/doris/pull/39330
    
    <!--Describe your changes.-->
---
 be/src/vec/aggregate_functions/aggregate_function_percentile.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_percentile.h 
b/be/src/vec/aggregate_functions/aggregate_function_percentile.h
index 3f83744f13e..f41fa3a490a 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_percentile.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_percentile.h
@@ -447,11 +447,14 @@ public:
 template <typename T>
 struct PercentileState {
     mutable std::vector<Counts<T>> vec_counts;
-    std::vector<double> vec_quantile;
+    std::vector<double> vec_quantile {-1};
     bool inited_flag = false;
 
     void write(BufferWritable& buf) const {
         write_binary(inited_flag, buf);
+        if (!inited_flag) {
+            return;
+        }
         int size_num = vec_quantile.size();
         write_binary(size_num, buf);
         for (const auto& quantile : vec_quantile) {
@@ -464,6 +467,9 @@ struct PercentileState {
 
     void read(BufferReadable& buf) {
         read_binary(inited_flag, buf);
+        if (!inited_flag) {
+            return;
+        }
         int size_num = 0;
         read_binary(size_num, buf);
         double data = 0.0;


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

Reply via email to