xinyiZzz commented on code in PR #15440: URL: https://github.com/apache/doris/pull/15440#discussion_r1060483526
########## be/src/vec/exec/join/process_hash_table_probe_impl.h: ########## @@ -674,20 +675,38 @@ Status ProcessHashTableProbe<JoinOpType>::process_data_in_hashtable(HashTableTyp } }; - for (; iter != hash_table_ctx.hash_table.end() && block_size < _batch_size; ++iter) { + for (; iter != hash_table_ctx.hash_table.end() && block_size < _batch_size;) { auto& mapped = iter->get_second(); if constexpr (std::is_same_v<Mapped, RowRefListWithFlag>) { if (mapped.visited) { - for (auto it = mapped.begin(); it.ok(); ++it) { - if constexpr (JoinOpType == TJoinOp::RIGHT_SEMI_JOIN) { + if constexpr (JoinOpType == TJoinOp::RIGHT_SEMI_JOIN) { + for (auto it = mapped.begin(); it.ok(); ++it) { insert_from_hash_table(it->block_offset, it->row_num); } + ++iter; + } else { + for (; visited_iter.ok() && block_size < _batch_size; ++visited_iter) { + insert_from_hash_table(visited_iter->block_offset, + visited_iter->row_num); + } + if (!visited_iter.ok()) { + ++iter; + } } } else { - for (auto it = mapped.begin(); it.ok(); ++it) { - if constexpr (JoinOpType != TJoinOp::RIGHT_SEMI_JOIN) { - insert_from_hash_table(it->block_offset, it->row_num); + if constexpr (JoinOpType != TJoinOp::RIGHT_SEMI_JOIN) { + visited_iter = mapped.begin(); + for (; visited_iter.ok() && block_size < _batch_size; ++visited_iter) { + insert_from_hash_table(visited_iter->block_offset, + visited_iter->row_num); + } + if (visited_iter.ok()) { + mapped.visited = true; Review Comment: After `mapped.visited=true`, next time can run `process_hash_table_probe_impl.h:681` `if (mapped.visited)`, continue to read the current mapped -- 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