github-actions[bot] commented on code in PR #25629:
URL: https://github.com/apache/doris/pull/25629#discussion_r1365137113


##########
be/src/vec/common/hash_table/hash_map.h:
##########
@@ -232,17 +233,48 @@ class JoinHashMapTable : public HashMapTable<Key, Cell, 
Hash, Grower, Allocator>
                     int probe_rows, std::vector<uint32_t>& probe_idxs,
                     std::vector<int>& build_idxs) {
         auto matched_cnt = 0;
-        while (probe_idx < probe_rows && matched_cnt < 4096) {
+        const auto batch_size = max_batch_size;
+
+        if (probe_idx == current_probe_idx) {
+            current_probe_idx = -1;
+            auto build_idx = current_build_idx;
+            current_build_idx = 0;
+
+            while (build_idx && LIKELY(matched_cnt < batch_size)) {
+                if (keys[probe_idx] == build_keys[build_idx]) {
+                    probe_idxs[matched_cnt] = probe_idx;
+                    build_idxs[matched_cnt] = build_idx;
+                    matched_cnt++;
+                }
+                build_idx = next[build_idx];
+            }
+
+            if (matched_cnt == max_batch_size && build_idx) {
+                current_probe_idx = probe_idx;
+                current_build_idx = build_idx;
+                return std::pair {probe_idx, matched_cnt};
+            }
+            probe_idx++;
+        }
+
+        while (LIKELY(probe_idx < probe_rows && matched_cnt < batch_size)) {

Review Comment:
   warning: boolean expression can be simplified by DeMorgan's theorem 
[readability-simplify-boolean-expr]
   ```cpp
           while (LIKELY(probe_idx < probe_rows && matched_cnt < batch_size)) {
                  ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/common/compiler_util.h:34:** expanded from macro 'LIKELY'
   ```cpp
   #define LIKELY(expr) __builtin_expect(!!(expr), 1)
                                          ^
   ```
   
   </details>
   



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