Skip to content

Commit 360fe14

Browse files
committed
IsSortedKernel
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 1dd80f7 commit 360fe14

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

vortex-array/src/aggregate_fn/fns/is_constant/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub mod primitive;
1010
mod struct_;
1111
mod varbin;
1212

13+
use vortex_error::VortexExpect;
1314
use vortex_error::VortexResult;
1415
use 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+
237241
pub 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> {

vortex-array/src/compute/is_constant.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use vortex_error::VortexResult;
88
use crate::ArrayRef;
99
use crate::LEGACY_SESSION;
1010
use 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
}

0 commit comments

Comments
 (0)