Skip to content

Commit

Permalink
fix return type
Browse files Browse the repository at this point in the history
  • Loading branch information
reswqa committed Sep 26, 2023
1 parent 6bc8019 commit 6c7a7d9
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions crates/polars-ops/src/chunked_array/list/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,26 +263,22 @@ pub trait ListNameSpaceImpl: AsList {
let ca = self.as_list();
let periods_s = periods.cast(&DataType::Int64)?;
let periods = periods_s.i64()?;

match periods.len() {
let out = match periods.len() {
1 => {
if let Some(periods) = periods.get(0) {
Ok(ca.apply_amortized(|s| s.as_ref().shift(periods)))
ca.apply_amortized(|s| s.as_ref().shift(periods))
} else {
Ok(ListChunked::full_null_with_dtype(
ca.name(),
ca.len(),
&ca.inner_dtype(),
))
ListChunked::full_null_with_dtype(ca.name(), ca.len(), &ca.inner_dtype())
}
},
_ => Ok(ca.zip_and_apply_amortized(periods, |opt_s, opt_periods| {
_ => ca.zip_and_apply_amortized(periods, |opt_s, opt_periods| {
match (opt_s, opt_periods) {
(Some(s), Some(periods)) => Some(s.as_ref().shift(periods)),
_ => None,
}
})),
}
}),
};
Ok(self.same_type(out))
}

fn lst_slice(&self, offset: i64, length: usize) -> ListChunked {
Expand Down

0 comments on commit 6c7a7d9

Please sign in to comment.