Helper: zero the values buffer of the output wherever the slot is null
| 2084 | |
| 2085 | // Helper: zero the values buffer of the output wherever the slot is null |
| 2086 | void InitializeNullSlots(const DataType& type, uint8_t* out_valid, uint8_t* out_values, |
| 2087 | const int64_t out_offset, const int64_t length) { |
| 2088 | BitRunReader bit_reader(out_valid, out_offset, length); |
| 2089 | int64_t offset = 0; |
| 2090 | const auto bit_width = checked_cast<const FixedWidthType&>(type).bit_width(); |
| 2091 | const auto byte_width = bit_util::BytesForBits(bit_width); |
| 2092 | while (true) { |
| 2093 | const auto run = bit_reader.NextRun(); |
| 2094 | if (run.length == 0) { |
| 2095 | break; |
| 2096 | } |
| 2097 | if (!run.set) { |
| 2098 | if (bit_width == 1) { |
| 2099 | bit_util::SetBitsTo(out_values, out_offset + offset, run.length, false); |
| 2100 | } else { |
| 2101 | std::memset(out_values + (out_offset + offset) * byte_width, 0, |
| 2102 | byte_width * run.length); |
| 2103 | } |
| 2104 | } |
| 2105 | offset += run.length; |
| 2106 | } |
| 2107 | DCHECK_EQ(offset, length); |
| 2108 | } |
| 2109 | |
| 2110 | // Implement 'coalesce' for any mix of scalar/array arguments for any fixed-width type |
| 2111 | template <typename Type> |
no test coverage detected