| 737 | // Recursive merge routine, typed on the first sort key |
| 738 | template <typename ArrowType> |
| 739 | Status MergeInternal(std::vector<ChunkedNullPartitionResult>* sorted, |
| 740 | int64_t null_count) { |
| 741 | auto merge_nulls = [&](CompressedChunkLocation* nulls_begin, |
| 742 | CompressedChunkLocation* nulls_middle, |
| 743 | CompressedChunkLocation* nulls_end, |
| 744 | CompressedChunkLocation* temp_indices, int64_t null_count) { |
| 745 | MergeNulls<ArrowType>(nulls_begin, nulls_middle, nulls_end, temp_indices, |
| 746 | null_count); |
| 747 | }; |
| 748 | auto merge_non_nulls = |
| 749 | [&](CompressedChunkLocation* range_begin, CompressedChunkLocation* range_middle, |
| 750 | CompressedChunkLocation* range_end, CompressedChunkLocation* temp_indices) { |
| 751 | MergeNonNulls<ArrowType>(range_begin, range_middle, range_end, temp_indices); |
| 752 | }; |
| 753 | |
| 754 | ChunkedMergeImpl merge_impl(sort_keys_[0].null_placement, std::move(merge_nulls), |
| 755 | std::move(merge_non_nulls)); |
| 756 | RETURN_NOT_OK(merge_impl.Init(ctx_, table_.num_rows())); |
| 757 | |
| 758 | while (sorted->size() > 1) { |
| 759 | auto out_it = sorted->begin(); |
| 760 | auto it = sorted->begin(); |
| 761 | while (it < sorted->end() - 1) { |
| 762 | const auto& left = *it++; |
| 763 | const auto& right = *it++; |
| 764 | DCHECK_EQ(left.overall_end(), right.overall_begin()); |
| 765 | *out_it++ = merge_impl.Merge(left, right, null_count); |
| 766 | } |
| 767 | if (it < sorted->end()) { |
| 768 | *out_it++ = *it++; |
| 769 | } |
| 770 | sorted->erase(out_it, sorted->end()); |
| 771 | } |
| 772 | return comparator_.status(); |
| 773 | } |
| 774 | |
| 775 | template <typename ArrowType> |
| 776 | void MergeNulls(CompressedChunkLocation* nulls_begin, |
nothing calls this directly
no test coverage detected