zhiqiang-hhhh commented on code in PR #33968:
URL: https://github.com/apache/doris/pull/33968#discussion_r1574390266


##########
be/src/vec/functions/function_ip.h:
##########
@@ -789,7 +789,7 @@ class FunctionIPv4CIDRToRange : public IFunction {
 
         for (size_t i = 0; i < input_rows_count; ++i) {
             auto ip = vec_ip_input[i];
-            auto cidr = vec_cidr_input[i];
+            auto cidr = col_const ? vec_cidr_input[0] : vec_cidr_input[i];

Review Comment:
   Do not add if branch in for loop, it may break auto vectorization.
   the final code pattern should be like
   ```
   bool is_ip_column_const;
   bool is_cird_column_const;
   // use unpack_if_const to initalize above two arguments
   ...
   if (is_ip_column_const && is_cird_column_const) {
        // not possible since we are using default impl for const
   } if (is_ip_column_const) {
        const ip_val = xxx 
       for () {
         xxxx
        }
   } else if (is_cird_column_const) {
        const cird_value = xxxx
        for () {
           xxxxx
        }
   } else {
        // both culumn case
   }
   ```



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