| 447 | } |
| 448 | |
| 449 | Status PartitionedHashJoinNode::BeginSpilledProbe() { |
| 450 | VLOG(2) << "BeginSpilledProbe\n" << NodeDebugString(); |
| 451 | DCHECK(input_partition_ == nullptr); |
| 452 | DCHECK(build_hash_partitions_.hash_partitions == nullptr); |
| 453 | DCHECK(probe_hash_partitions_.empty()); |
| 454 | DCHECK(!spilled_partitions_.empty()); |
| 455 | |
| 456 | PhjBuilderPartition* build_input_partition; |
| 457 | bool repartitioned; |
| 458 | RETURN_IF_ERROR(builder_->BeginSpilledProbe(buffer_pool_client(), runtime_profile(), |
| 459 | &repartitioned, &build_input_partition, &build_hash_partitions_)); |
| 460 | |
| 461 | auto it = spilled_partitions_.find(build_input_partition->id()); |
| 462 | DCHECK(it != spilled_partitions_.end()) |
| 463 | << "All spilled build partitions must have a corresponding probe partition"; |
| 464 | input_partition_ = std::move(it->second); |
| 465 | spilled_partitions_.erase(it); |
| 466 | DCHECK_EQ(build_input_partition, input_partition_->build_partition()); |
| 467 | DCHECK_EQ(input_partition_->probe_rows()->BytesPinned(false), 0) << NodeDebugString(); |
| 468 | |
| 469 | ht_ctx_->set_level(build_input_partition->level() + (repartitioned ? 1 : 0)); |
| 470 | if (!repartitioned && build_input_partition->hash_tbl() == nullptr) { |
| 471 | // Build skipped the hash table build, which can only happen if there are no probe |
| 472 | // rows. |
| 473 | DCHECK_EQ(0, input_partition_->probe_rows()->num_rows()) |
| 474 | << build_input_partition->DebugString() << endl |
| 475 | << input_partition_->probe_rows()->DebugString(); |
| 476 | return Status::OK(); |
| 477 | } else if (repartitioned) { |
| 478 | RETURN_IF_ERROR(PrepareForPartitionedProbe()); |
| 479 | } else { |
| 480 | RETURN_IF_ERROR(PrepareForUnpartitionedProbe()); |
| 481 | } |
| 482 | COUNTER_ADD(num_probe_rows_partitioned_, input_partition_->probe_rows()->num_rows()); |
| 483 | return Status::OK(); |
| 484 | } |
| 485 | |
| 486 | Status PartitionedHashJoinNode::ProcessProbeBatch(RowBatch* out_batch) { |
| 487 | DCHECK_ENUM_EQ(probe_state_, ProbeState::PROBING_IN_BATCH); |
nothing calls this directly
no test coverage detected