File tree Expand file tree Collapse file tree
aggregate_fn/fns/is_constant Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ pub mod primitive;
1010mod struct_;
1111mod varbin;
1212
13+ use vortex_error:: VortexExpect ;
1314use vortex_error:: VortexResult ;
1415use vortex_mask:: Mask ;
1516
@@ -234,9 +235,10 @@ impl IsConstantPartial {
234235 }
235236}
236237
238+ static NAMES : std:: sync:: LazyLock < FieldNames > =
239+ std:: sync:: LazyLock :: new ( || FieldNames :: from ( [ "is_constant" , "value" ] ) ) ;
240+
237241pub fn make_is_constant_partial_dtype ( element_dtype : & DType ) -> DType {
238- static NAMES : std:: sync:: LazyLock < FieldNames > =
239- std:: sync:: LazyLock :: new ( || FieldNames :: from ( [ "is_constant" , "value" ] ) ) ;
240242 DType :: Struct (
241243 StructFields :: new (
242244 NAMES . clone ( ) ,
@@ -409,8 +411,7 @@ impl AggregateFnVTable for IsConstant {
409411 }
410412
411413 fn finalize ( & self , partials : ArrayRef ) -> VortexResult < ArrayRef > {
412- // TODO: extract is_constant field from struct array
413- Ok ( partials)
414+ partials. get_item ( NAMES . get ( 0 ) . vortex_expect ( "out of bounds" ) . clone ( ) )
414415 }
415416
416417 fn finalize_scalar ( & self , partial : Scalar ) -> VortexResult < Scalar > {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use vortex_error::VortexResult;
88use crate :: ArrayRef ;
99use crate :: LEGACY_SESSION ;
1010use crate :: VortexSessionExecute ;
11+ use crate :: compute:: Options ;
1112
1213/// Computes whether an array has constant values.
1314///
@@ -59,7 +60,7 @@ impl Default for IsConstantOpts {
5960 }
6061}
6162
62- impl super :: Options for IsConstantOpts {
63+ impl Options for IsConstantOpts {
6364 fn as_any ( & self ) -> & dyn Any {
6465 self
6566 }
You can’t perform that action at this time.
0 commit comments