Skip to content

Commit

Permalink
Use faster validity zip
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller committed Dec 7, 2024
1 parent df36551 commit b917c5c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions crates/polars-time/src/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,7 @@ pub fn replace_datetime(

// Ensure nulls are propagated.
if ca.has_nulls() {
let mask = &ca.is_not_null();
let null = &Int64Chunked::full_null(PlSmallStr::EMPTY, n);
out = out
.physical()
.zip_with(mask, null)?
.into_datetime(ca.time_unit(), ca.time_zone().clone());
out.merge_validities(ca.chunks());
}

Ok(out)
Expand Down Expand Up @@ -154,9 +149,7 @@ pub fn replace_date(

// Ensure nulls are propagated.
if ca.has_nulls() {
let mask = &ca.is_not_null();
let null = &Int32Chunked::full_null(PlSmallStr::EMPTY, n);
out = out.physical().zip_with(mask, null)?.into_date();
out.merge_validities(ca.chunks());
}

Ok(out)
Expand Down

0 comments on commit b917c5c

Please sign in to comment.