vortex_array/arrays/struct_/compute/
is_constant.rs1use vortex_error::VortexResult;
5
6use crate::arrays::{StructArray, StructVTable};
7use crate::compute::{self, IsConstantKernel, IsConstantKernelAdapter, IsConstantOpts};
8use crate::register_kernel;
9
10impl IsConstantKernel for StructVTable {
11 fn is_constant(
12 &self,
13 array: &StructArray,
14 opts: &IsConstantOpts,
15 ) -> VortexResult<Option<bool>> {
16 let children = array.children();
17 if children.is_empty() {
18 return Ok(Some(true));
19 }
20
21 for child in children.iter() {
22 match compute::is_constant_opts(child, opts)? {
23 None => return Ok(None),
25 Some(false) => return Ok(Some(false)),
26 Some(true) => {}
27 }
28 }
29
30 Ok(Some(true))
31 }
32}
33
34register_kernel!(IsConstantKernelAdapter(StructVTable).lift());