| 53 | } |
| 54 | |
| 55 | bool HashJoinBridge::setHashTable( |
| 56 | std::shared_ptr<BaseHashTable> table, |
| 57 | SpillPartitionSet spillPartitionSet, |
| 58 | bool hasNullKeys, |
| 59 | SpillOffsetToBitsSet offsetToJoinBits) { |
| 60 | BOLT_CHECK_NOT_NULL(table, "setHashTable called with null table"); |
| 61 | |
| 62 | auto spillPartitionIdSet = toSpillPartitionIdSet(spillPartitionSet); |
| 63 | |
| 64 | bool hasSpillData; |
| 65 | std::vector<ContinuePromise> promises; |
| 66 | { |
| 67 | std::lock_guard<std::mutex> l(mutex_); |
| 68 | BOLT_CHECK(started_); |
| 69 | BOLT_CHECK(!buildResult_.has_value()); |
| 70 | BOLT_CHECK(restoringSpillShards_.empty()); |
| 71 | |
| 72 | if (restoringSpillPartitionId_.has_value()) { |
| 73 | for (const auto& id : spillPartitionIdSet) { |
| 74 | BOLT_DCHECK_LT( |
| 75 | restoringSpillPartitionId_->partitionBitOffset(), |
| 76 | id.partitionBitOffset()); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | for (auto& partitionEntry : spillPartitionSet) { |
| 81 | const auto id = partitionEntry.first; |
| 82 | BOLT_CHECK_EQ(spillPartitionSets_.count(id), 0); |
| 83 | spillPartitionSets_.emplace(id, std::move(partitionEntry.second)); |
| 84 | } |
| 85 | buildResult_ = HashBuildResult( |
| 86 | std::move(table), |
| 87 | std::move(restoringSpillPartitionId_), |
| 88 | std::move(spillPartitionIdSet), |
| 89 | hasNullKeys, |
| 90 | offsetToJoinBits); |
| 91 | restoringSpillPartitionId_.reset(); |
| 92 | |
| 93 | hasSpillData = !spillPartitionSets_.empty(); |
| 94 | promises = std::move(promises_); |
| 95 | } |
| 96 | notify(std::move(promises)); |
| 97 | return hasSpillData; |
| 98 | } |
| 99 | |
| 100 | void HashJoinBridge::setAntiJoinHasNullKeys() { |
| 101 | std::vector<ContinuePromise> promises; |