jacktengg commented on code in PR #24044:
URL: https://github.com/apache/doris/pull/24044#discussion_r1318833123


##########
be/src/vec/exec/vset_operation_node.cpp:
##########
@@ -682,47 +682,41 @@ void 
VSetOperationNode<is_intersect>::refresh_hash_table() {
                         HashTableCtxType tmp_hash_table;
                         bool is_need_shrink =
                                 
arg.hash_table.should_be_shrink(_valid_element_in_hash_tbl);
-                        if (is_need_shrink) {
+                        if (is_intersect || is_need_shrink) {
                             tmp_hash_table.hash_table.init_buf_size(
                                     _valid_element_in_hash_tbl / 
arg.hash_table.get_factor() + 1);
                         }
 
                         arg.init_once();
                         auto& iter = arg.iter;
                         auto iter_end = arg.hash_table.end();
-                        while (iter != iter_end) {
-                            auto& mapped = iter->get_second();
-                            auto it = mapped.begin();
-
-                            if constexpr (is_intersect) { //intersected
-                                if (it->visited) {
-                                    it->visited = false;
-                                    if (is_need_shrink) {
-                                        
tmp_hash_table.hash_table.insert(iter->get_value());
+                        std::visit(
+                                [&](auto is_need_shrink_const) {
+                                    while (iter != iter_end) {
+                                        auto& mapped = iter->get_second();
+                                        auto it = mapped.begin();
+
+                                        if constexpr (is_intersect) { 
//intersected
+                                            if (it->visited) {
+                                                it->visited = false;

Review Comment:
   You mean reset the `visited` flag? For intersect,  clear the visited flag is 
necessary, since  the new inserted `iter->get_value()` will have the value of 
`it->visited`.



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