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

zhangchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a371e1d4c5 [fix](window_funnel_function) fix upgrade compatibility due 
to the added field in `WindowFunnelState` (#22416)
a371e1d4c5 is described below

commit a371e1d4c54c2f9c57f8102e558eba8a55496b62
Author: bobhan1 <bh2444151...@outlook.com>
AuthorDate: Tue Aug 1 12:08:55 2023 +0800

    [fix](window_funnel_function) fix upgrade compatibility due to the added 
field in `WindowFunnelState` (#22416)
---
 be/src/common/config.cpp                                  |  3 +++
 be/src/common/config.h                                    |  3 +++
 .../aggregate_function_window_funnel.h                    | 15 ++++++++++-----
 .../suites/nereids_p0/aggregate/window_funnel.groovy      | 10 ++++++++++
 .../suites/query_p0/aggregate/window_funnel.groovy        | 10 ++++++++++
 5 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index c2e0cfe169..070a5d6657 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -1047,6 +1047,9 @@ DEFINE_mInt64(lookup_connection_cache_bytes_limit, 
"4294967296");
 // level of compression when using LZ4_HC, whose defalut value is 
LZ4HC_CLEVEL_DEFAULT
 DEFINE_mInt64(LZ4_HC_compression_level, "9");
 
+// enable window_funnel_function with different modes
+DEFINE_mBool(enable_window_funnel_function_v2, "false");
+
 #ifdef BE_TEST
 // test s3
 DEFINE_String(test_s3_resource, "resource");
diff --git a/be/src/common/config.h b/be/src/common/config.h
index f177d86b3b..466a26a69b 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -1085,6 +1085,9 @@ DECLARE_mInt64(lookup_connection_cache_bytes_limit);
 // level of compression when using LZ4_HC, whose defalut value is 
LZ4HC_CLEVEL_DEFAULT
 DECLARE_mInt64(LZ4_HC_compression_level);
 
+// enable window_funnel_function with different modes
+DECLARE_mBool(enable_window_funnel_function_v2);
+
 #ifdef BE_TEST
 // test s3
 DECLARE_String(test_s3_resource);
diff --git a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h 
b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h
index 422d8f1650..a69e5d0cd6 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h
@@ -212,8 +212,10 @@ struct WindowFunnelState {
     void write(BufferWritable& out) const {
         write_var_int(max_event_level, out);
         write_var_int(window, out);
-        
write_var_int(static_cast<std::underlying_type_t<WindowFunnelMode>>(window_funnel_mode),
-                      out);
+        if (config::enable_window_funnel_function_v2) {
+            
write_var_int(static_cast<std::underlying_type_t<WindowFunnelMode>>(window_funnel_mode),
+                          out);
+        }
         write_var_int(events.size(), out);
 
         for (int64_t i = 0; i < events.size(); i++) {
@@ -229,9 +231,12 @@ struct WindowFunnelState {
         read_var_int(event_level, in);
         max_event_level = (int)event_level;
         read_var_int(window, in);
-        int64_t mode;
-        read_var_int(mode, in);
-        window_funnel_mode = static_cast<WindowFunnelMode>(mode);
+        window_funnel_mode = WindowFunnelMode::DEFAULT;
+        if (config::enable_window_funnel_function_v2) {
+            int64_t mode;
+            read_var_int(mode, in);
+            window_funnel_mode = static_cast<WindowFunnelMode>(mode);
+        }
         int64_t size = 0;
         read_var_int(size, in);
         for (int64_t i = 0; i < size; i++) {
diff --git a/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy 
b/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy
index c2ea9469b7..6ad68bd2a3 100644
--- a/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy
+++ b/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy
@@ -105,6 +105,16 @@ suite("window_funnel") {
     """
     sql """ DROP TABLE IF EXISTS ${tableName} """
 
+    String backend_id;
+    def backendId_to_backendIP = [:]
+    def backendId_to_backendHttpPort = [:]
+    getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort);
+    for (String backendId in backendId_to_backendIP.keySet()) {
+        String be_host = backendId_to_backendIP[backendId]
+        String be_http_port = backendId_to_backendHttpPort[backendId]
+        curl("POST", 
"http://${be_host}:${be_http_port}/api/update_config?enable_window_funnel_function_v2=true";)
+    }
+
     sql """ DROP TABLE IF EXISTS ${tableName} """
     sql """
         CREATE TABLE IF NOT EXISTS ${tableName} (
diff --git a/regression-test/suites/query_p0/aggregate/window_funnel.groovy 
b/regression-test/suites/query_p0/aggregate/window_funnel.groovy
index 83f39ae000..1fc4cf555b 100644
--- a/regression-test/suites/query_p0/aggregate/window_funnel.groovy
+++ b/regression-test/suites/query_p0/aggregate/window_funnel.groovy
@@ -104,6 +104,16 @@ suite("window_funnel") {
     """
     sql """ DROP TABLE IF EXISTS ${tableName} """
 
+    String backend_id;
+    def backendId_to_backendIP = [:]
+    def backendId_to_backendHttpPort = [:]
+    getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort);
+    for (String backendId in backendId_to_backendIP.keySet()) {
+        String be_host = backendId_to_backendIP[backendId]
+        String be_http_port = backendId_to_backendHttpPort[backendId]
+        curl("POST", 
"http://${be_host}:${be_http_port}/api/update_config?enable_window_funnel_function_v2=true";)
+    }
+
     sql """ DROP TABLE IF EXISTS ${tableName} """
     sql """
         CREATE TABLE IF NOT EXISTS ${tableName} (


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

Reply via email to