| 200 | // `offset` is used when this is called on a chunk of a chunked array |
| 201 | template <typename ArrayType, typename Partitioner> |
| 202 | NullPartitionResult PartitionNullLikes(uint64_t* indices_begin, uint64_t* indices_end, |
| 203 | const ArrayType& values, int64_t offset, |
| 204 | NullPlacement null_placement) { |
| 205 | if constexpr (has_null_like_values<typename ArrayType::TypeClass>()) { |
| 206 | Partitioner partitioner; |
| 207 | if (null_placement == NullPlacement::AtStart) { |
| 208 | auto null_likes_end = |
| 209 | partitioner(indices_begin, indices_end, [&values, &offset](uint64_t ind) { |
| 210 | return std::isnan(values.GetView(ind - offset)); |
| 211 | }); |
| 212 | return NullPartitionResult::NullsAtStart(indices_begin, indices_end, |
| 213 | null_likes_end); |
| 214 | } else { |
| 215 | auto null_likes_begin = |
| 216 | partitioner(indices_begin, indices_end, [&values, &offset](uint64_t ind) { |
| 217 | return !std::isnan(values.GetView(ind - offset)); |
| 218 | }); |
| 219 | return NullPartitionResult::NullsAtEnd(indices_begin, indices_end, |
| 220 | null_likes_begin); |
| 221 | } |
| 222 | } else { |
| 223 | return NullPartitionResult::NoNulls(indices_begin, indices_end, null_placement); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | // Move nulls to end of array. |
| 228 | // |