Skip to main content

vortex_arrow/executor/
null.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use std::sync::Arc;
5
6use arrow_array::ArrayRef as ArrowArrayRef;
7use arrow_array::NullArray as ArrowNullArray;
8use vortex_array::ArrayRef;
9use vortex_array::ExecutionCtx;
10use vortex_array::arrays::NullArray;
11use vortex_error::VortexResult;
12
13/// Convert a canonical NullArray directly to Arrow.
14pub fn canonical_null_to_arrow(array: &NullArray) -> ArrowArrayRef {
15    Arc::new(ArrowNullArray::new(array.len()))
16}
17
18pub(super) fn to_arrow_null(
19    array: ArrayRef,
20    ctx: &mut ExecutionCtx,
21) -> VortexResult<ArrowArrayRef> {
22    let null_array = array.execute::<NullArray>(ctx)?;
23    Ok(canonical_null_to_arrow(&null_array))
24}