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

Method buildNextPartition

bolt/exec/SpillableWindowBuild.cpp:48–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47template <bool needSort>
48void SpillableWindowBuild<needSort>::buildNextPartition() {
49 if (currentSpilledPartition_ < spillers_.size() &&
50 spillers_[currentSpilledPartition_] != nullptr) {
51 partitionStartRows_.push_back(sortedRows_.size());
52 lastRun_ = true;
53 // spill remaining data in inputRows
54 spill();
55 // get Aggregate results
56 auto spillPartition = spillers_[currentSpilledPartition_]->finishSpill();
57 stats_ += spillers_[currentSpilledPartition_]->stats();
58 BOLT_CHECK_EQ(
59 spilledNumRows_,
60 spillers_[currentSpilledPartition_]->stats().spilledRows);
61 if constexpr (needSort) {
62 merges_.push_back(spillPartition.createUnorderedReader(
63 pool_,
64 spillConfig_->spillUringEnabled,
65 (spillConfig_->rowBasedSpillMode !=
66 common::RowBasedSpillMode::DISABLE)));
67 } else {
68 merges_.push_back(spillPartition.createUnorderedReader(pool_));
69 }
70 // RowContainer is empty, release memory
71 if (data_->numRows() == 0) {
72 data_->clear();
73 data_->pool()->release();
74 }
75 } else {
76 merges_.push_back(nullptr);
77 spillers_.push_back(nullptr);
78 sortedRows_.insert(sortedRows_.end(), inputRows_.begin(), inputRows_.end());
79 partitionStartRows_.push_back(sortedRows_.size());
80 inputRows_.clear();
81 }
82}
83
84template <bool needSort>
85void SpillableWindowBuild<needSort>::setupSpiller() {

Callers

nothing calls this directly

Calls 12

createUnorderedReaderMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
finishSpillMethod · 0.45
statsMethod · 0.45
numRowsMethod · 0.45
clearMethod · 0.45
releaseMethod · 0.45
poolMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected