MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / extract_bool

Function extract_bool

nodedb-strict/src/arrow_extract.rs:151–171  ·  view source on GitHub ↗
(
    decoder: &TupleDecoder,
    tuples: &[&[u8]],
    col_idx: usize,
    _n: usize,
)

Source from the content-addressed store, hash-verified

149}
150
151fn extract_bool(
152 decoder: &TupleDecoder,
153 tuples: &[&[u8]],
154 col_idx: usize,
155 _n: usize,
156) -> Result<ArrayRef, StrictError> {
157 let (null_buf, null_count) = build_null_buffer(decoder, tuples, col_idx)?;
158 let mut bools = Vec::with_capacity(tuples.len());
159
160 for tuple in tuples {
161 if let Some(raw) = decoder.extract_fixed_raw(tuple, col_idx)? {
162 bools.push(raw[0] != 0);
163 } else {
164 bools.push(false);
165 }
166 }
167
168 let bool_buf = BooleanBuffer::from(bools);
169 let array = BooleanArray::new(bool_buf, if null_count > 0 { Some(null_buf) } else { None });
170 Ok(Arc::new(array))
171}
172
173fn extract_timestamp(
174 decoder: &TupleDecoder,

Callers 1

extract_column_to_arrowFunction · 0.85

Calls 4

build_null_bufferFunction · 0.85
extract_fixed_rawMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected