jacktengg commented on code in PR #38954:
URL: https://github.com/apache/doris/pull/38954#discussion_r1708483390


##########
be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:
##########
@@ -72,138 +80,233 @@ WindowFunnelMode string_to_window_funnel_mode(const 
String& string) {
     }
 }
 
-template <typename DateValueType, typename NativeType>
+template <TypeIndex TYPE_INDEX, typename NativeType>
 struct WindowFunnelState {
-    std::vector<std::pair<DateValueType, int>> events;
-    int max_event_level;
-    bool sorted;
+    using DateValueType = std::conditional_t<TYPE_INDEX == 
TypeIndex::DateTimeV2,
+                                             DateV2Value<DateTimeV2ValueType>, 
VecDateTimeValue>;
+    int event_count = 0;
     int64_t window;
-    WindowFunnelMode window_funnel_mode;
     bool enable_mode;
+    WindowFunnelMode window_funnel_mode;
+    mutable MutableColumnPtr timestamp_column;
+    mutable MutableColumns event_columns;
+    Block block;
+    SortDescription sort_description {1};
+    bool sorted;
+    bool is_merge;
 
     WindowFunnelState() {
-        sorted = true;
-        max_event_level = 0;
+        event_count = 0;
         window = 0;
         window_funnel_mode = WindowFunnelMode::INVALID;
+
+        sort_description[0].column_number = 0;
+        sort_description[0].direction = 1;
+        sort_description[0].nulls_direction = -1;
+        sorted = false;
+        is_merge = false;
+    }
+    WindowFunnelState(int arg_event_count) : WindowFunnelState() {
+        timestamp_column = ColumnVector<NativeType>::create();
+        event_count = arg_event_count;
+        event_columns.resize(event_count);
+        for (int i = 0; i < event_count; i++) {
+            event_columns[i] = ColumnVector<UInt8>::create();
+        }
     }
 
     void reset() {
-        sorted = true;
-        max_event_level = 0;
         window = 0;
-        events.shrink_to_fit();
+        timestamp_column->clear();
+        for (auto& column : event_columns) {
+            column->clear();
+        }
+        block.clear_column_data();
+        sorted = false;
+        is_merge = false;
     }
 
-    void add(const DateValueType& timestamp, int event_idx, int event_num, 
int64_t win,
-             WindowFunnelMode mode) {
+    void add(const IColumn** arg_columns, ssize_t row_num, int64_t win, 
WindowFunnelMode mode) {

Review Comment:
   ```row_num```  of ```AggregateFunctionWindowFunnel::add``` is ```ssize_t```



-- 
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]

Reply via email to