Skip to main content

vortex_alp/alp/compute/
nan_count.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use vortex_array::compute::NaNCountKernel;
5use vortex_array::compute::NaNCountKernelAdapter;
6use vortex_array::compute::nan_count;
7use vortex_array::register_kernel;
8use vortex_error::VortexResult;
9
10use crate::ALPArray;
11use crate::ALPVTable;
12
13impl NaNCountKernel for ALPVTable {
14    fn nan_count(&self, array: &ALPArray) -> VortexResult<usize> {
15        // NANs can only be in patches
16        if let Some(patches) = array.patches() {
17            nan_count(patches.values())
18        } else {
19            Ok(0)
20        }
21    }
22}
23
24register_kernel!(NaNCountKernelAdapter(ALPVTable).lift());