Returns a new [`NullBuffer`] where each bit in the current null buffer is repeated `count` times. This is useful for masking the nulls of the child of a FixedSizeListArray based on its parent
(&self, count: usize)
| 114 | /// is repeated `count` times. This is useful for masking the nulls of |
| 115 | /// the child of a FixedSizeListArray based on its parent |
| 116 | pub fn expand(&self, count: usize) -> Self { |
| 117 | let capacity = self.buffer.len().checked_mul(count).unwrap(); |
| 118 | let mut buffer = MutableBuffer::new_null(capacity); |
| 119 | |
| 120 | // Expand each bit within `null_mask` into `element_len` |
| 121 | // bits, constructing the implicit mask of the child elements |
| 122 | for i in 0..self.buffer.len() { |
| 123 | if self.is_null(i) { |
| 124 | continue; |
| 125 | } |
| 126 | for j in 0..count { |
| 127 | crate::bit_util::set_bit(buffer.as_mut(), i * count + j) |
| 128 | } |
| 129 | } |
| 130 | Self { |
| 131 | buffer: BooleanBuffer::new(buffer.into(), 0, capacity), |
| 132 | null_count: self.null_count * count, |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /// Returns the length of this [`NullBuffer`] in bits |
| 137 | #[inline] |
no test coverage detected