| 633 | } |
| 634 | |
| 635 | RowVectorPtr NestedLoopJoinProbe::genCrossProductSingleBuildVector( |
| 636 | const RowVectorPtr& buildVector, |
| 637 | const RowTypePtr& outputType, |
| 638 | const std::vector<IdentityProjection>& probeProjections, |
| 639 | const std::vector<IdentityProjection>& buildProjections) { |
| 640 | BOLT_CHECK(isSingleBuildVector()); |
| 641 | std::vector<VectorPtr> projectedChildren(outputType->size()); |
| 642 | const auto buildRowCount = buildVector->size(); |
| 643 | |
| 644 | // Calculate how many probe rows we can cover without exceeding |
| 645 | // outputBatchSize_. |
| 646 | if (buildRowCount > outputBatchSize_) { |
| 647 | probeRowCount_ = 1; |
| 648 | } else { |
| 649 | probeRowCount_ = std::min( |
| 650 | static_cast<vector_size_t>(outputBatchSize_ / buildRowCount), |
| 651 | input_->size() - probeRow_); |
| 652 | } |
| 653 | const size_t numOutputRows = probeRowCount_ * buildRowCount; |
| 654 | |
| 655 | // Generate probe dictionary indices. |
| 656 | auto rawProbeIndices = |
| 657 | initializeRowNumberMapping(probeIndices_, numOutputRows, pool()); |
| 658 | for (auto i = 0; i < probeRowCount_; ++i) { |
| 659 | std::fill( |
| 660 | rawProbeIndices.begin() + i * buildRowCount, |
| 661 | rawProbeIndices.begin() + (i + 1) * buildRowCount, |
| 662 | probeRow_ + i); |
| 663 | } |
| 664 | |
| 665 | // Generate build dictionary indices. |
| 666 | auto rawBuildIndices_ = |
| 667 | initializeRowNumberMapping(buildIndices_, numOutputRows, pool()); |
| 668 | for (auto i = 0; i < probeRowCount_; ++i) { |
| 669 | std::iota( |
| 670 | rawBuildIndices_.begin() + i * buildRowCount, |
| 671 | rawBuildIndices_.begin() + (i + 1) * buildRowCount, |
| 672 | 0); |
| 673 | } |
| 674 | |
| 675 | projectChildren( |
| 676 | projectedChildren, |
| 677 | input_, |
| 678 | probeProjections, |
| 679 | numOutputRows, |
| 680 | probeIndices_); |
| 681 | projectChildren( |
| 682 | projectedChildren, |
| 683 | buildVector, |
| 684 | buildProjections, |
| 685 | numOutputRows, |
| 686 | buildIndices_); |
| 687 | |
| 688 | return std::make_shared<RowVector>( |
| 689 | pool(), outputType, nullptr, numOutputRows, std::move(projectedChildren)); |
| 690 | } |
| 691 | |
| 692 | RowVectorPtr NestedLoopJoinProbe::genCrossProductMultipleBuildVectors( |
nothing calls this directly
no test coverage detected