MCPcopy Create free account
hub / github.com/apache/arrow / MarkDuplicates

Function MarkDuplicates

cpp/src/arrow/compute/kernels/vector_rank.cc:41–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40template <typename ValueSelector>
41void 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
72template <typename ArrowType>
73Result<NullLikePartition> DoSortAndMarkDuplicate(

Calls 3

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected