From 1df4889505bb2256d7c3738e9c3218ef23d3f72c Mon Sep 17 00:00:00 2001 From: Rossi Sun Date: Tue, 31 Dec 2024 22:37:18 +0800 Subject: [PATCH] GH-45135: [C++] Remove useless "hash table ready" states in swiss join (#45136) ### Rationale for this change See #45135 ### What changes are included in this PR? Remove the useless states. ### Are these changes tested? Existing tests suffice. ### Are there any user-facing changes? None. * GitHub Issue: #45135 Authored-by: Rossi Sun Signed-off-by: Rossi Sun --- cpp/src/arrow/acero/swiss_join.cc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cpp/src/arrow/acero/swiss_join.cc b/cpp/src/arrow/acero/swiss_join.cc index 53092c898eac9..c88279fd54b09 100644 --- a/cpp/src/arrow/acero/swiss_join.cc +++ b/cpp/src/arrow/acero/swiss_join.cc @@ -2462,7 +2462,6 @@ class SwissJoin : public HashJoinImpl { output_batch_callback_ = std::move(output_batch_callback); finished_callback_ = std::move(finished_callback); - hash_table_ready_.store(false); cancelled_.store(false); { std::lock_guard lock(state_mutex_); @@ -2474,7 +2473,6 @@ class SwissJoin : public HashJoinImpl { local_states_.resize(num_threads_); for (int i = 0; i < num_threads_; ++i) { RETURN_NOT_OK(local_states_[i].stack.Init(pool_, kTempStackUsage)); - local_states_[i].hash_table_ready = false; local_states_[i].num_output_batches = 0; local_states_[i].materialize.Init(pool_, proj_map_left, proj_map_right); } @@ -2520,11 +2518,6 @@ class SwissJoin : public HashJoinImpl { return status(); } - if (!local_states_[thread_index].hash_table_ready) { - local_states_[thread_index].hash_table_ready = hash_table_ready_.load(); - } - ARROW_DCHECK(local_states_[thread_index].hash_table_ready); - ExecBatch keypayload_batch; ARROW_ASSIGN_OR_RAISE(keypayload_batch, KeyPayloadFromInput(/*side=*/0, &batch)); arrow::util::TempVectorStack* temp_stack = &local_states_[thread_index].stack; @@ -2689,7 +2682,6 @@ class SwissJoin : public HashJoinImpl { hash_table_.payloads(), hash_table_.key_to_payload() == nullptr); } - hash_table_ready_.store(true); residual_filter_.OnBuildFinished(); @@ -2910,7 +2902,6 @@ class SwissJoin : public HashJoinImpl { JoinResultMaterialize materialize; std::vector temp_column_arrays; int64_t num_output_batches; - bool hash_table_ready; }; std::vector local_states_; @@ -2927,7 +2918,6 @@ class SwissJoin : public HashJoinImpl { // The other flags that follow them, protected by mutex, will be queried or // updated only a fixed number of times during entire join processing. // - std::atomic hash_table_ready_; std::atomic cancelled_; // Mutex protecting state flags.