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

Method spillInput

bolt/exec/HashProbe.cpp:569–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569void HashProbe::spillInput(RowVectorPtr& input) {
570 BOLT_CHECK(needSpillInput());
571
572 const auto numInput = input->size();
573 prepareInputIndicesBuffers(
574 input->size(), spiller_->state().spilledPartitionSet());
575 const auto singlePartition =
576 spillHashFunction_->partition(*input, spillPartitions_);
577
578 vector_size_t numNonSpillingInput = 0;
579 for (auto row = 0; row < numInput; ++row) {
580 const auto partition = singlePartition.has_value() ? singlePartition.value()
581 : spillPartitions_[row];
582 if (!spiller_->isSpilled(partition)) {
583 rawNonSpillInputIndicesBuffer_[numNonSpillingInput++] = row;
584 continue;
585 }
586 rawSpillInputIndicesBuffers_[partition][numSpillInputs_[partition]++] = row;
587 }
588 if (numNonSpillingInput == numInput) {
589 return;
590 }
591
592 // Ensure vector are lazy loaded before spilling.
593 for (int32_t i = 0; i < input->childrenSize(); ++i) {
594 input->childAt(i)->loadedVector();
595 }
596
597 for (int32_t partition = 0; partition < numSpillInputs_.size(); ++partition) {
598 const auto numSpillInputs = numSpillInputs_[partition];
599 if (numSpillInputs == 0) {
600 continue;
601 }
602 BOLT_CHECK(spiller_->isSpilled(partition));
603 spiller_->spill(
604 partition,
605 wrapAndCombineDict(
606 numSpillInputs, spillInputIndicesBuffers_[partition], input));
607 }
608
609 if (numNonSpillingInput == 0) {
610 input = nullptr;
611 } else {
612 input = wrapAndCombineDict(
613 numNonSpillingInput, nonSpillInputIndicesBuffer_, input);
614 }
615}
616
617void HashProbe::prepareInputIndicesBuffers(
618 vector_size_t numInput,

Callers

nothing calls this directly

Calls 12

wrapAndCombineDictFunction · 0.85
spilledPartitionSetMethod · 0.80
has_valueMethod · 0.80
childAtMethod · 0.80
sizeMethod · 0.45
stateMethod · 0.45
partitionMethod · 0.45
valueMethod · 0.45
isSpilledMethod · 0.45
childrenSizeMethod · 0.45
loadedVectorMethod · 0.45
spillMethod · 0.45

Tested by

no test coverage detected