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


##########
be/src/vec/functions/array/function_array_set.h:
##########
@@ -198,11 +208,23 @@ struct ArraySetImpl {
         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)[row - 1];
-            size_t right_len = (*right_data.offsets_ptr)[row] - right_off;
+            size_t count = 0, left_off, left_len, right_off, right_len;
+            //the `if` can be automatically exchange order with `for` to 
guarantee performance.
+            if (left_const) {
+                left_off = (*left_data.offsets_ptr)[-1];

Review Comment:
   better move the code out the for 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: 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