Skip to content

Commit

Permalink
use Ok(make_array(array.data_ref().clone()))
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiayu Liu committed Jun 3, 2021
1 parent 20c4a74 commit daf1655
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arrow/src/compute/kernels/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
//! Defines windowing functions, like `shift`ing

use crate::array::{Array, ArrayRef};
use crate::{array::new_null_array, compute::concat};
use crate::{array::PrimitiveArray, datatypes::ArrowPrimitiveType, error::Result};
use crate::{
array::{make_array, new_null_array},
compute::concat,
};
use num::{abs, clamp};

/// Shifts array by defined number of items (to left or right)
Expand Down Expand Up @@ -59,7 +62,7 @@ where
{
let value_len = values.len() as i64;
if offset == 0 {
Ok(values.slice(0, values.len()))
Ok(make_array(values.data_ref().clone()))
} else if offset == i64::MIN || abs(offset) >= value_len {
Ok(new_null_array(&T::DATA_TYPE, values.len()))
} else {
Expand Down

0 comments on commit daf1655

Please sign in to comment.