| 491 | } |
| 492 | return std::make_unique<TreeOfLosers<RowBasedSpillMergeStream>>( |
| 493 | std::move(streams)); |
| 494 | } |
| 495 | |
| 496 | std::unique_ptr<TreeOfLosers<RowBasedSpillMergeStream>> |
| 497 | SpillPartition::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 | } |
no test coverage detected