| 39 | |
| 40 | template <typename ValueSelector> |
| 41 | void MarkDuplicates(const NullLikePartition& sorted, ValueSelector&& value_selector) { |
| 42 | using T = decltype(value_selector(int64_t{})); |
| 43 | |
| 44 | // Process non-nulls |
| 45 | if (!sorted.non_null_like_range.empty()) { |
| 46 | auto it = sorted.non_null_like_range.begin(); |
| 47 | T prev_value = value_selector(*it); |
| 48 | while (++it < sorted.non_null_like_range.end()) { |
| 49 | T curr_value = value_selector(*it); |
| 50 | if (curr_value == prev_value) { |
| 51 | *it |= kDuplicateMask; |
| 52 | } |
| 53 | prev_value = curr_value; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // Process nans |
| 58 | if (!sorted.nan_range.empty()) { |
| 59 | for (auto& index : sorted.nan_range.subspan(1)) { |
| 60 | index |= kDuplicateMask; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // Process nulls |
| 65 | if (!sorted.null_range.empty()) { |
| 66 | for (auto& index : sorted.null_range.subspan(1)) { |
| 67 | index |= kDuplicateMask; |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | template <typename ArrowType> |
| 73 | Result<NullLikePartition> DoSortAndMarkDuplicate( |
no test coverage detected