| 563 | } |
| 564 | |
| 565 | Status BuildHashTable_exec_task(size_t thread_index, int64_t /*task_id*/) { |
| 566 | AccumulationQueue batches = std::move(build_batches_); |
| 567 | dict_build_.InitEncoder(*schema_[1], &hash_table_keys_, ctx_->exec_context()); |
| 568 | bool has_payload = (schema_[1]->num_cols(HashJoinProjection::PAYLOAD) > 0); |
| 569 | if (has_payload) { |
| 570 | InitEncoder(1, HashJoinProjection::PAYLOAD, &hash_table_payloads_); |
| 571 | } |
| 572 | hash_table_empty_ = batches.empty(); |
| 573 | RETURN_NOT_OK(dict_build_.Init(*schema_[1], hash_table_empty_ ? nullptr : &batches[0], |
| 574 | ctx_->exec_context())); |
| 575 | |
| 576 | for (size_t ibatch = 0; ibatch < batches.batch_count(); ++ibatch) { |
| 577 | if (cancelled_) { |
| 578 | return Status::Cancelled("Hash join cancelled"); |
| 579 | } |
| 580 | const ExecBatch& batch = batches[ibatch]; |
| 581 | DCHECK_GT(batch.length, 0); |
| 582 | int32_t num_rows_before = hash_table_keys_.num_rows(); |
| 583 | RETURN_NOT_OK(dict_build_.EncodeBatch(thread_index, *schema_[1], batch, |
| 584 | &hash_table_keys_, ctx_->exec_context())); |
| 585 | if (has_payload) { |
| 586 | RETURN_NOT_OK( |
| 587 | EncodeBatch(1, HashJoinProjection::PAYLOAD, &hash_table_payloads_, batch)); |
| 588 | } |
| 589 | int32_t num_rows_after = hash_table_keys_.num_rows(); |
| 590 | for (int32_t irow = num_rows_before; irow < num_rows_after; ++irow) { |
| 591 | hash_table_.insert(std::make_pair(hash_table_keys_.encoded_row(irow), irow)); |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | return Status::OK(); |
| 596 | } |
| 597 | |
| 598 | Status BuildHashTable_on_finished(size_t thread_index) { |
| 599 | ARROW_DCHECK_EQ(build_batches_.batch_count(), 0); |
nothing calls this directly
no test coverage detected