Build a zero-filled array of the given datatype. Used for the suffix-renamed padding columns. Zero-filled rather than all-null so the parquet reader can't shortcut on null-array statistics — the wide-schema slowdown reproduces ~35 % wider with zeros than with nulls.
(dt: &DataType, n: usize)
| 106 | /// wide-schema slowdown reproduces ~35 % wider with zeros than with |
| 107 | /// nulls. |
| 108 | fn zero_array(dt: &DataType, n: usize) -> ArrayRef { |
| 109 | match dt { |
| 110 | DataType::Int32 => { |
| 111 | Arc::new(Int32Array::from_iter_values(std::iter::repeat_n(0i32, n))) |
| 112 | } |
| 113 | DataType::Int64 => { |
| 114 | Arc::new(Int64Array::from_iter_values(std::iter::repeat_n(0i64, n))) |
| 115 | } |
| 116 | DataType::Float64 => Arc::new(Float64Array::from_iter_values( |
| 117 | std::iter::repeat_n(0.0f64, n), |
| 118 | )), |
| 119 | DataType::Date32 => { |
| 120 | Arc::new(Date32Array::from_iter_values(std::iter::repeat_n(0i32, n))) |
| 121 | } |
| 122 | DataType::Utf8 => { |
| 123 | Arc::new(StringArray::from_iter_values(std::iter::repeat_n("", n))) |
| 124 | } |
| 125 | _ => panic!("zero_array: unsupported datatype {dt:?}"), |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | /// Eight-column base schema. All fields nullable so the schema is |
| 130 | /// uniform across base and zero-filled replicated copies. |
no test coverage detected
searching dependent graphs…