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

Function PartitionNullsOnly

cpp/src/arrow/compute/kernels/vector_sort_internal.h:178–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176// `offset` is used when this is called on a chunk of a chunked array
177template <typename Partitioner>
178NullPartitionResult PartitionNullsOnly(uint64_t* indices_begin, uint64_t* indices_end,
179 const Array& values, int64_t offset,
180 NullPlacement null_placement) {
181 if (values.null_count() == 0) {
182 return NullPartitionResult::NoNulls(indices_begin, indices_end, null_placement);
183 }
184 Partitioner partitioner;
185 if (null_placement == NullPlacement::AtStart) {
186 auto nulls_end = partitioner(
187 indices_begin, indices_end,
188 [&values, &offset](uint64_t ind) { return values.IsNull(ind - offset); });
189 return NullPartitionResult::NullsAtStart(indices_begin, indices_end, nulls_end);
190 } else {
191 auto nulls_begin = partitioner(
192 indices_begin, indices_end,
193 [&values, &offset](uint64_t ind) { return !values.IsNull(ind - offset); });
194 return NullPartitionResult::NullsAtEnd(indices_begin, indices_end, nulls_begin);
195 }
196}
197
198// Move non-null null-like values to end of array.
199//

Callers

nothing calls this directly

Calls 5

chunk_indexMethod · 0.80
index_in_chunkMethod · 0.80
null_countMethod · 0.45
IsNullMethod · 0.45
ResolveMethod · 0.45

Tested by

no test coverage detected