MCPcopy Create free account
hub / github.com/apache/arrow-rs / align_nulls

Function align_nulls

arrow-data/src/ffi.rs:101–119  ·  view source on GitHub ↗

Aligns the provided `nulls` to the provided `data_offset` This is a temporary measure until offset is removed from ArrayData (#1799)

(data_offset: usize, nulls: Option<&NullBuffer>)

Source from the content-addressed store, hash-verified

99///
100/// This is a temporary measure until offset is removed from ArrayData (#1799)
101fn align_nulls(data_offset: usize, nulls: Option<&NullBuffer>) -> Option<Buffer> {
102 let nulls = nulls?;
103 if data_offset == nulls.offset() {
104 // Underlying buffer is already aligned
105 return Some(nulls.buffer().clone());
106 }
107 if data_offset == 0 {
108 return Some(nulls.inner().sliced());
109 }
110 let mut builder = MutableBuffer::new_null(data_offset + nulls.len());
111 set_bits(
112 builder.as_slice_mut(),
113 nulls.validity(),
114 data_offset,
115 nulls.offset(),
116 nulls.len(),
117 );
118 Some(builder.into())
119}
120
121struct ArrayPrivateData {
122 #[allow(dead_code)]

Callers 1

newMethod · 0.85

Calls 9

set_bitsFunction · 0.85
slicedMethod · 0.80
validityMethod · 0.80
offsetMethod · 0.45
cloneMethod · 0.45
bufferMethod · 0.45
innerMethod · 0.45
lenMethod · 0.45
as_slice_mutMethod · 0.45

Tested by

no test coverage detected