| 35 | /// \return The size of spaced buffer. |
| 36 | template <typename T> |
| 37 | inline int SpacedCompress(const T* src, int num_values, const uint8_t* valid_bits, |
| 38 | int64_t valid_bits_offset, T* output) { |
| 39 | int num_valid_values = 0; |
| 40 | |
| 41 | arrow::internal::SetBitRunReader reader(valid_bits, valid_bits_offset, num_values); |
| 42 | while (true) { |
| 43 | const auto run = reader.NextRun(); |
| 44 | if (run.length == 0) { |
| 45 | break; |
| 46 | } |
| 47 | std::memcpy(output + num_valid_values, src + run.position, run.length * sizeof(T)); |
| 48 | num_valid_values += static_cast<int32_t>(run.length); |
| 49 | } |
| 50 | |
| 51 | return num_valid_values; |
| 52 | } |
| 53 | |
| 54 | /// \brief Relocate values according to a validity bitmap, to the right |
| 55 | /// |