|
6 | 6 | use std::sync::Arc; |
7 | 7 |
|
8 | 8 | use vortex_buffer::{BufferMut, ByteBuffer, ByteBufferMut}; |
9 | | -use vortex_error::{VortexExpect, VortexResult, vortex_ensure}; |
| 9 | +use vortex_error::{vortex_ensure, VortexExpect, VortexResult}; |
10 | 10 | use vortex_mask::MaskMut; |
11 | 11 |
|
12 | | -use crate::binaryview::BinaryViewType; |
13 | 12 | use crate::binaryview::vector::BinaryViewVector; |
14 | | -use crate::binaryview::view::{BinaryView, validate_views}; |
| 13 | +use crate::binaryview::view::{validate_views, BinaryView}; |
| 14 | +use crate::binaryview::{BinaryViewScalar, BinaryViewType}; |
15 | 15 | use crate::{VectorMutOps, VectorOps}; |
16 | 16 |
|
17 | 17 | // Default capacity for new string data buffers of 2MiB. |
@@ -264,6 +264,20 @@ impl<T: BinaryViewType> VectorMutOps for BinaryViewVectorMut<T> { |
264 | 264 | self.validity.append_n(false, n); |
265 | 265 | } |
266 | 266 |
|
| 267 | + fn append_zeros(&mut self, n: usize) { |
| 268 | + self.views.push_n(BinaryView::empty_view(), n); |
| 269 | + self.validity.append_n(true, n); |
| 270 | + } |
| 271 | + |
| 272 | + fn append_scalars(&mut self, scalar: &BinaryViewScalar<T>, n: usize) { |
| 273 | + match scalar.value() { |
| 274 | + None => self.append_nulls(n), |
| 275 | + Some(v) => { |
| 276 | + self.append_owned_values(v.clone(), n); |
| 277 | + } |
| 278 | + } |
| 279 | + } |
| 280 | + |
267 | 281 | fn freeze(mut self) -> BinaryViewVector<T> { |
268 | 282 | // Freeze all components, close any in-progress views |
269 | 283 | self.flush_open_buffer(); |
@@ -296,7 +310,7 @@ mod tests { |
296 | 310 | use std::ops::Deref; |
297 | 311 | use std::sync::Arc; |
298 | 312 |
|
299 | | - use vortex_buffer::{ByteBuffer, buffer, buffer_mut}; |
| 313 | + use vortex_buffer::{buffer, buffer_mut, ByteBuffer}; |
300 | 314 | use vortex_mask::{Mask, MaskMut}; |
301 | 315 |
|
302 | 316 | use crate::binaryview::view::BinaryView; |
|
0 commit comments