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


##########
be/src/vec/functions/array/function_array_set.h:
##########
@@ -216,6 +267,66 @@ struct ArraySetImpl {
         }
         return true;
     }
+    template <typename ColumnType>
+    static bool _execute_internal_lconst(ColumnArrayMutableData& dst,
+                                         const ColumnArrayExecutionData& 
left_data,
+                                         const ColumnArrayExecutionData& 
right_data) {
+        using Impl = OpenSetImpl<operation, ColumnType>;
+        if (!check_column<ColumnType>(*left_data.nested_col)) {
+            return false;
+        }
+        constexpr auto execute_left_column_first = 
Impl::Action::execute_left_column_first;
+        size_t current = 0;
+        Impl impl;
+        for (size_t row = 0; row < left_data.offsets_ptr->size(); ++row) {
+            size_t count = 0;
+            size_t left_off = (*left_data.offsets_ptr)[-1];
+            size_t left_len = (*left_data.offsets_ptr)[0] - left_off;
+            size_t right_off = (*right_data.offsets_ptr)[row - 1];
+            size_t right_len = (*right_data.offsets_ptr)[row] - right_off;
+            if constexpr (execute_left_column_first) {
+                impl.template apply<true>(left_data, left_off, left_len, dst, 
&count);
+                impl.template apply<false>(right_data, right_off, right_len, 
dst, &count);
+            } else {
+                impl.template apply<false>(right_data, right_off, right_len, 
dst, &count);
+                impl.template apply<true>(left_data, left_off, left_len, dst, 
&count);
+            }
+            current += count;
+            dst.offsets_ptr->push_back(current);
+            impl.reset();
+        }
+        return true;
+    }
+    template <typename ColumnType>
+    static bool _execute_internal_rconst(ColumnArrayMutableData& dst,
+                                         const ColumnArrayExecutionData& 
left_data,
+                                         const ColumnArrayExecutionData& 
right_data) {
+        using Impl = OpenSetImpl<operation, ColumnType>;
+        if (!check_column<ColumnType>(*left_data.nested_col)) {
+            return false;
+        }
+        constexpr auto execute_left_column_first = 
Impl::Action::execute_left_column_first;
+        size_t current = 0;
+        Impl impl;
+        for (size_t row = 0; row < left_data.offsets_ptr->size(); ++row) {
+            size_t count = 0;
+            size_t left_off = (*left_data.offsets_ptr)[row - 1];
+            size_t left_len = (*left_data.offsets_ptr)[row] - left_off;
+            size_t right_off = (*right_data.offsets_ptr)[-1];

Review Comment:
   out of the loop



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