MCPcopy Create free account
hub / github.com/bytedance/bolt / ensureOutputFits

Method ensureOutputFits

bolt/exec/SpillableWindowBuild.cpp:374–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372// Spill large partitions
373template <bool needSort>
374void SpillableWindowBuild<needSort>::ensureOutputFits() {
375 if (spillConfig_->testSpillPct > 0 && inputRows_.size() > 0) {
376 spill();
377 return;
378 }
379
380 std::optional<size_t> rowLength = std::nullopt;
381 if (rowLength_.has_value()) {
382 rowLength = rowLength_;
383 } else if (estimateRowSize().has_value()) {
384 rowLength = estimateRowSize();
385 }
386 const uint64_t outputBufferSizeToReserve =
387 (rowLength.has_value() ? (rowLength.value() * maxBatchRows_)
388 : preferredOutputBatchBytes_) *
389 1.2;
390
391 {
392 memory::ReclaimableSectionGuard guard(nonReclaimableSection_);
393 if (data_->pool()->maybeReserve(outputBufferSizeToReserve)) {
394 return;
395 }
396 }
397 LOG(WARNING) << "Failed to reserve "
398 << succinctBytes(outputBufferSizeToReserve)
399 << " for memory pool " << data_->pool()->name()
400 << ", usage: " << succinctBytes(data_->pool()->currentBytes())
401 << ", reservation: "
402 << succinctBytes(data_->pool()->reservedBytes());
403}
404
405template <bool needSort>
406void SpillableWindowBuild<needSort>::storeRows() {

Callers

nothing calls this directly

Calls 9

succinctBytesFunction · 0.85
has_valueMethod · 0.80
sizeMethod · 0.45
valueMethod · 0.45
maybeReserveMethod · 0.45
poolMethod · 0.45
nameMethod · 0.45
currentBytesMethod · 0.45
reservedBytesMethod · 0.45

Tested by

no test coverage detected