Skip to content

Commit

Permalink
ease branch prediction
Browse files Browse the repository at this point in the history
  • Loading branch information
petrosbar committed Apr 19, 2024
1 parent 7b68752 commit 01064c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/polars-core/src/series/any_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,13 @@ fn any_values_to_list(
#[allow(unused_mut)]
let mut out: ListChunked = if inner_type == &DataType::Null {
let mut first_value_dtype = DataType::Null;
let mut set_first = false;
avs.iter()
.map(|av| match av {
AnyValue::List(b) => {
if !b.is_empty() && matches!(first_value_dtype, DataType::Null) {
if !set_first && first_value_dtype != *b.dtype() {
first_value_dtype = b.dtype().clone();
set_first = true;
} else if b.is_empty() || b.null_count() == b.len() {
return b.cast(&first_value_dtype).ok();
}
Expand Down

0 comments on commit 01064c3

Please sign in to comment.