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

Method createRowBasedOrderedReaderWithLength

bolt/exec/Spill.cpp:493–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491 }
492 return std::make_unique<TreeOfLosers<RowBasedSpillMergeStream>>(
493 std::move(streams));
494}
495
496std::unique_ptr<TreeOfLosers<RowBasedSpillMergeStream>>
497SpillPartition::createRowBasedOrderedReaderWithLength(
498 memory::MemoryPool* pool,
499 RowContainer* const rows,
500 bool canJit,
501 bool spillUringEnabled) {
502#ifdef ENABLE_BOLT_JIT
503 bolt::jit::CompiledModuleSP jitModule;
504 if (rows != nullptr && canJit && RowContainer::JITable(rows->keyTypes())) {
505 // Extract compare flags from sorting keys
506 std::vector<CompareFlags> cmpFlags;
507 for (const auto& sortKey : files_[0].sortingKeys) {
508 cmpFlags.push_back(sortKey.second);
509 }
510
511 if (cmpFlags.empty()) {
512 cmpFlags.resize(rows->keyTypes().size(), CompareFlags());
513 }
514 jitModule = std::get<0>(rows->codegenCompare(
515 rows->keyTypes(),
516 cmpFlags,
517 bytedance::bolt::jit::CmpType::CMP_SPILL,
518 true));
519 LOG(INFO) << "JIT enabled for row based spill ordered reader!";
520 }
521#endif
522
523 std::vector<std::unique_ptr<RowBasedSpillMergeStream>> streams;
524 streams.reserve(files_.size());
525 for (auto& fileInfo : files_) {
526 BOLT_CHECK(fileInfo.rowInfo.has_value());
527 streams.push_back(RowBasedFileSpillMergeStream::createWithLength(
528 RowBasedSpillReadFile::create(fileInfo, pool, spillUringEnabled)
529#ifdef ENABLE_BOLT_JIT
530 ,
531 jitModule
532#endif
533 ));
534 }
535 files_.clear();
536 // Check if the partition is empty or not.
537 if (FOLLY_UNLIKELY(streams.empty())) {
538 return nullptr;
539 }

Callers 1

noMoreInputCommonMethod · 0.80

Calls 11

codegenCompareMethod · 0.80
getFuncPtrMethod · 0.80
has_valueMethod · 0.80
CompareFlagsClass · 0.50
createFunction · 0.50
push_backMethod · 0.45
emptyMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
reserveMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected