Skip to main content

new_null_array

Function new_null_array 

Source
pub fn new_null_array(data_type: &DataType, len: usize) -> Result<ArrayRef>
Expand description

An all-null array of the given type and length.

Stage 2’s decoder and the record-batch padding path both need this, and it doubles as the coverage check that every family can be built from a bare DataType.

§Errors

DataError::InvalidFixedSize when a fixed-size type carries a non-positive width.

use astrs_data::array::{new_null_array, Array};
use astrs_data::DataType;

let nulls = new_null_array(&DataType::Float32, 4)?;
assert_eq!(nulls.len(), 4);
assert_eq!(nulls.null_count(), 4);