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