| 166 | } |
| 167 | |
| 168 | std::optional<HashJoinBridge::SpillInput> HashJoinBridge::spillInputOrFuture( |
| 169 | ContinueFuture* future) { |
| 170 | std::lock_guard<std::mutex> l(mutex_); |
| 171 | BOLT_CHECK(started_); |
| 172 | BOLT_CHECK(!cancelled_, "Getting spill input after join is aborted"); |
| 173 | BOLT_DCHECK( |
| 174 | !restoringSpillPartitionId_.has_value() || !buildResult_.has_value()); |
| 175 | |
| 176 | if (!restoringSpillPartitionId_.has_value()) { |
| 177 | if (spillPartitionSets_.empty()) { |
| 178 | return HashJoinBridge::SpillInput{}; |
| 179 | } else { |
| 180 | promises_.emplace_back("HashJoinBridge::spillInputOrFuture"); |
| 181 | *future = promises_.back().getSemiFuture(); |
| 182 | return std::nullopt; |
| 183 | } |
| 184 | } |
| 185 | BOLT_CHECK(!restoringSpillShards_.empty()); |
| 186 | auto spillShard = std::move(restoringSpillShards_.back()); |
| 187 | restoringSpillShards_.pop_back(); |
| 188 | return SpillInput(std::move(spillShard)); |
| 189 | } |
| 190 | |
| 191 | bool isLeftNullAwareJoinWithFilter( |
| 192 | const std::shared_ptr<const core::HashJoinNode>& joinNode) { |