File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
encodings/runend/src/compute Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,11 @@ pub(crate) mod filter;
55mod invert;
66mod is_sorted;
77mod min_max;
8+ mod nan_count;
89mod scalar_at;
910mod slice;
1011pub ( crate ) mod take;
1112mod take_from;
12- mod nan_count;
1313
1414use vortex_array:: Array ;
1515use vortex_array:: compute:: {
Original file line number Diff line number Diff line change 1+
Original file line number Diff line number Diff line change @@ -30,20 +30,19 @@ pub fn nan_count(array: &dyn Array) -> VortexResult<Option<usize>> {
3030 return Ok ( None ) ;
3131 }
3232
33- // Only float arrays can have NaNs
34- if !array. dtype ( ) . is_float ( ) {
35- return Ok ( Some ( 0 ) ) ;
36- }
37-
3833 let nan_count = array
3934 . statistics ( )
4035 . get_as :: < usize > ( Stat :: NaNCount )
4136 . and_then ( Precision :: as_exact) ;
37+
4238 if let Some ( nan_count) = nan_count {
4339 return Ok ( Some ( nan_count) ) ;
4440 }
4541
46- let nan_count = if let Some ( fn_) = array. vtable ( ) . nan_count_fn ( ) {
42+ // Only float arrays can have NaNs
43+ let nan_count = if !array. dtype ( ) . is_float ( ) {
44+ Some ( 0 )
45+ } else if let Some ( fn_) = array. vtable ( ) . nan_count_fn ( ) {
4746 fn_. nan_count ( array) ?
4847 } else {
4948 let canonical = array. to_canonical ( ) ?;
You can’t perform that action at this time.
0 commit comments