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


##########
be/src/vec/functions/function_string.h:
##########
@@ -1017,6 +1022,34 @@ class FunctionStringConcat : public IFunction {
         return std::make_shared<DataTypeString>();
     }
 
+    Status open(FunctionContext* context, FunctionContext::FunctionStateScope 
scope) override {
+        if (scope == FunctionContext::THREAD_LOCAL) {
+            return Status::OK();
+        }
+        std::shared_ptr<ConcatState> state = std::make_shared<ConcatState>();
+
+        context->set_function_state(scope, state);
+
+        state->use_state = true;
+
+        // Optimize function calls like this:
+        // concat(col, "123", "abc", "456") -> tail = "123abc456"
+        for (size_t i = 1; i < context->get_num_args(); i++) {
+            const auto* column_string = context->get_constant_col(i);
+            if (column_string == nullptr) {
+                state->use_state = false;
+                break;
+            }
+            auto string_vale = column_string->column_ptr->get_data_at(0);

Review Comment:
   Check here is NULL const, what happen



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