HappenLee commented on code in PR #49419:
URL: https://github.com/apache/doris/pull/49419#discussion_r2108637528


##########
be/src/vec/aggregate_functions/aggregate_function_min_max.h:
##########
@@ -521,18 +524,110 @@ struct AggregateFunctionMinData : Data {
     static const char* name() { return "min"; }
 };
 
+struct AggregateFunctionAnyBase {
+    constexpr static bool IS_ANY = true;
+    static const char* name() { return "any"; }
+};
+
+// this is used for plain type about any_value function
 template <typename Data>
-struct AggregateFunctionAnyData : Data {
+struct AggregateFunctionAnyData : Data, AggregateFunctionAnyBase {
     using Self = AggregateFunctionAnyData;
     using Data::IsFixedLength;
-    constexpr static bool IS_ANY = true;
 
     void change_if_better(const IColumn& column, size_t row_num, Arena*) {
         this->change_first_time(column, row_num, nullptr);
     }
+
     void change_if_better(const Self& to, Arena*) { 
this->change_first_time(to, nullptr); }
+};
 
-    static const char* name() { return "any"; }
+// this is used for complex type about any_value function
+struct SingleValueDataComplexType : AggregateFunctionAnyBase {
+    constexpr static bool IsFixedLength = false;
+    using Self = SingleValueDataComplexType;
+
+    SingleValueDataComplexType() = default;
+
+    SingleValueDataComplexType(const DataTypes& argument_types, int 
be_version) {
+        column_type = argument_types[0];
+        column_data = column_type->create_column();
+        be_exec_version = be_version;
+    }
+
+    bool has() const { return has_value; }
+
+    void change_first_time(const IColumn& column, size_t row_num) {
+        if (UNLIKELY(!has())) {
+            change(column, row_num);
+        }
+    }
+
+    void change_first_time(const Self& to) {
+        if (UNLIKELY(!has() && to.has())) {
+            change(to);
+        }
+    }
+
+    void change(const IColumn& column, size_t row_num) { change_impl(column, 
row_num); }

Review Comment:
   no need two change func. use `change_impl` is enough



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

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


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

Reply via email to