| 46 | } |
| 47 | template <bool needSort> |
| 48 | void 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 | |
| 84 | template <bool needSort> |
| 85 | void SpillableWindowBuild<needSort>::setupSpiller() { |
nothing calls this directly
no test coverage detected