You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/17 16:11:44 UTC

[GitHub] [arrow] amol- commented on a change in pull request #12437: ARROW-14908: [C++][R] Multiple scanners plus join gives segfault when use_threads=FALSE

amol- commented on a change in pull request #12437:
URL: https://github.com/apache/arrow/pull/12437#discussion_r809221088



##########
File path: cpp/src/arrow/compute/exec/hash_join.cc
##########
@@ -896,6 +896,17 @@ class HashJoinBasicImpl : public HashJoinImpl {
     std::vector<uint8_t> has_match;
   };
   std::vector<ThreadLocalState> local_states_;
+  ThreadLocalState& GetLocalState(size_t thread_index) {
+    if (ARROW_PREDICT_FALSE(thread_index >= local_states_.size())) {
+      size_t old_size = local_states_.size();
+      local_states_.resize(thread_index + 1);
+      for (size_t i = old_size; i < local_states_.size(); ++i) {
+        local_states_[i].is_initialized = false;
+        local_states_[i].is_has_match_initialized = false;
+      }
+    }
+    return local_states_[thread_index];
+  }

Review comment:
       I'm curios, given that during the `Init` the vector is set to the size equal to the number of threads, when does it happen that `GetLocalState` is invoked with a thread index outside of the already allocated ones? I thought we were using threadpools and thus the amount of threads was stable. Are we recycling them or something like that?




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org