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/09/12 18:59:00 UTC
[GitHub] [arrow] save-buffer commented on a diff in pull request #13669: ARROW-16389: [C++][Acero] Add spilling for hash join
save-buffer commented on code in PR #13669:
URL: https://github.com/apache/arrow/pull/13669#discussion_r968814344
##########
cpp/src/arrow/compute/exec/accumulation_queue.cc:
##########
@@ -48,11 +50,221 @@ void AccumulationQueue::InsertBatch(ExecBatch batch) {
batches_.emplace_back(std::move(batch));
}
+void AccumulationQueue::SetBatch(size_t idx, ExecBatch batch)
+{
+ ARROW_DCHECK(idx < batches_.size());
+ arrow::util::AtomicFetchSub(&row_count_, batches_[idx].length, std::memory_order_relaxed);
+ arrow::util::AtomicFetchAdd(&row_count_, batch.length, std::memory_order_relaxed);
+ batches_[idx] = std::move(batch);
+}
+
void AccumulationQueue::Clear() {
row_count_ = 0;
batches_.clear();
}
-ExecBatch& AccumulationQueue::operator[](size_t i) { return batches_[i]; }
+ Status SpillingAccumulationQueue::Init(QueryContext *ctx)
+ {
+ ctx_ = ctx;
+ partition_locks_.Init(ctx_->max_concurrency(), kNumPartitions);
+ return Status::OK();
Review Comment:
We could, but almost every other Init returns Status so I felt it was better to be consistent.
--
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