| 716 | // Recursive merge routine, typed on the first sort key |
| 717 | template <typename ArrowType> |
| 718 | Status MergeInternal(std::vector<ChunkedNullLikePartition>* sorted) { |
| 719 | // merge function where the ranges compare equal on the first sort-key |
| 720 | auto merge_remaining_sort_keys = [&](std::span<CompressedChunkLocation> range, |
| 721 | size_t middle, |
| 722 | CompressedChunkLocation* temp_indices) { |
| 723 | MergeRemainingSortKeys(range, middle, temp_indices); |
| 724 | }; |
| 725 | |
| 726 | auto merge_non_nulls = [&](std::span<CompressedChunkLocation> range, size_t middle, |
| 727 | CompressedChunkLocation* temp_indices) { |
| 728 | MergeNonNulls<ArrowType>(range, middle, temp_indices); |
| 729 | }; |
| 730 | |
| 731 | ChunkedMergeImpl merge_impl(sort_keys_[0].null_placement, |
| 732 | std::move(merge_remaining_sort_keys), |
| 733 | std::move(merge_non_nulls)); |
| 734 | RETURN_NOT_OK(merge_impl.Init(ctx_, table_.num_rows())); |
| 735 | |
| 736 | while (sorted->size() > 1) { |
| 737 | auto out_it = sorted->begin(); |
| 738 | auto it = sorted->begin(); |
| 739 | while (it < sorted->end() - 1) { |
| 740 | const auto& left = *it++; |
| 741 | const auto& right = *it++; |
| 742 | DCHECK_EQ(left.overall_end(), right.overall_begin()); |
| 743 | *out_it++ = merge_impl.Merge(left, right); |
| 744 | } |
| 745 | if (it < sorted->end()) { |
| 746 | *out_it++ = *it++; |
| 747 | } |
| 748 | sorted->erase(out_it, sorted->end()); |
| 749 | } |
| 750 | return comparator_.status(); |
| 751 | } |
| 752 | |
| 753 | void MergeRemainingSortKeys(std::span<CompressedChunkLocation> range, size_t middle, |
| 754 | CompressedChunkLocation* temp_indices) { |
nothing calls this directly
no test coverage detected