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

Method sortPartitions

bolt/exec/WindowBuild.cpp:222–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222void WindowBuild::sortPartitions() {
223 sortRows_.resize(numRows_);
224 RowContainerIterator iter;
225 data_->listRows(&iter, numRows_, sortRows_.data());
226
227#ifdef ENABLE_BOLT_JIT
228 if (cmp_ == nullptr && enableJit_) {
229 if (data_->JITable(data_->keyTypes())) {
230 auto [jitMod, rowRowCmpfn] = data_->codegenCompare(
231 data_->keyTypes(),
232 sortSpillCompareFlags_,
233 bytedance::bolt::jit::CmpType::SORT_LESS,
234 true);
235 jitModule_ = std::move(jitMod);
236 cmp_ = (RowRowCompare)jitModule_->getFuncPtr(rowRowCmpfn);
237 }
238 }
239 if (cmp_) {
240 sorter_.sort(sortRows_.begin(), sortRows_.end(), cmp_);
241 } else {
242#endif
243
244#ifdef ENABLE_META_SORT
245 MetaRowsSorterWraper<BufferRows>::MetaCodegenSort(
246 sortedRows_,
247 data_.get(),
248 sorter_,
249 data_->keyIndices(),
250 sortCompareFlags_);
251#else
252 sorter_.sort(
253 sortRows_.begin(),
254 sortRows_.end(),
255 [this](const char* leftRow, const char* rightRow) {
256 for (vector_size_t index = 0; index < sortSpillCompareFlags_.size();
257 ++index) {
258 if (auto result = data_->compare(
259 leftRow, rightRow, index, sortSpillCompareFlags_[index])) {
260 return result < 0;
261 }
262 }
263 return false;
264 });
265#endif
266
267#ifdef ENABLE_BOLT_JIT
268 }
269#endif
270}
271
272void WindowBuild::ensureInputFits(const RowVectorPtr& input) {
273 if (spillConfig_ == nullptr) {
274 return;
275 }
276
277 const int64_t numRows = data_->numRows();
278 if (numRows == 0) {
279 // 'data_' is empty. Nothing to spill.

Callers

nothing calls this directly

Calls 12

JITableMethod · 0.80
codegenCompareMethod · 0.80
getFuncPtrMethod · 0.80
resizeMethod · 0.45
listRowsMethod · 0.45
dataMethod · 0.45
sortMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected