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


##########
be/src/vec/aggregate_functions/aggregate_function_java_udaf.h:
##########
@@ -292,54 +316,87 @@ class AggregateJavaUdaf final
     }
 
     void create(AggregateDataPtr __restrict place) const override {
-        new (place) Data(argument_types.size());
-        Status status = Status::OK();
-        RETURN_IF_STATUS_ERROR(status, data(place).init_udaf(_fn));
+        if (_first_created) {
+            new (place) Data(argument_types.size());
+            Status status = Status::OK();
+            RETURN_IF_STATUS_ERROR(status, this->data(place).init_udaf(_fn));
+            RETURN_IF_STATUS_ERROR(status,
+                                   this->data(place).set_create_flag(
+                                           place, 
const_cast<AggregateDataPtr&>(_exec_place),
+                                           
const_cast<bool*>(&_first_created)));
+        }
+    }
+
+    void destroy(AggregateDataPtr __restrict place) const noexcept override {
+        if (place == _exec_place) {
+            this->data(_exec_place).destroy(reinterpret_cast<int64_t>(place));

Review Comment:
   should not call here



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