| 734 | } |
| 735 | |
| 736 | return ranges; |
| 737 | } |
| 738 | |
| 739 | void BaseVector::copy( |
| 740 | const BaseVector* source, |
| 741 | const SelectivityVector& rows, |
| 742 | const vector_size_t* toSourceRow, |
| 743 | bool canCopyAll) { |
| 744 | if (!rows.hasSelections()) { |
| 745 | return; |
| 746 | } |
| 747 | std::vector<CopyRange> ranges; |
| 748 | if (toSourceRow == nullptr) { |
| 749 | BOLT_CHECK_GE(source->size(), rows.end()); |
| 750 | ranges = toCopyRanges(rows); |
| 751 | } else { |
| 752 | ranges.reserve(rows.end()); |
| 753 | rows.applyToSelected([&](vector_size_t row) { |
| 754 | const auto sourceRow = toSourceRow[row]; |
| 755 | BOLT_DCHECK_GT(source->size(), sourceRow); |
| 756 | ranges.push_back({sourceRow, row, 1}); |
| 757 | }); |
| 758 | } |
| 759 | copyRanges(source, ranges); |
| 760 | } |