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

Function InitializeNullSlots

cpp/src/arrow/compute/kernels/scalar_if_else.cc:2086–2108  ·  view source on GitHub ↗

Helper: zero the values buffer of the output wherever the slot is null

Source from the content-addressed store, hash-verified

2084
2085// Helper: zero the values buffer of the output wherever the slot is null
2086void 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
2111template <typename Type>

Callers 1

ExecArrayCoalesceFunction · 0.85

Calls 4

BytesForBitsFunction · 0.85
SetBitsToFunction · 0.50
bit_widthMethod · 0.45
NextRunMethod · 0.45

Tested by

no test coverage detected