From 18c61be688c5342e161ae96fda78d5db29b220e0 Mon Sep 17 00:00:00 2001 From: Marshall Crumiller Date: Fri, 3 Jan 2025 17:51:01 -0500 Subject: [PATCH] Add fast quit for numeric --- crates/polars-ops/src/series/ops/horizontal.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/polars-ops/src/series/ops/horizontal.rs b/crates/polars-ops/src/series/ops/horizontal.rs index 739330ad0aed..deb71f44e736 100644 --- a/crates/polars-ops/src/series/ops/horizontal.rs +++ b/crates/polars-ops/src/series/ops/horizontal.rs @@ -350,7 +350,10 @@ pub fn mean_horizontal( // All remaining must be numeric (or null). for col in &columns[first_non_null_idx + 1..] { let dtype = col.dtype(); - if !(dtype.is_numeric() + if !ignore_nulls && dtype == &DataType::Null { + // The presence of a single null column guarantees the output is all-null. + return null_with_supertype(columns, true); + } else if !(dtype.is_numeric() || dtype.is_decimal() || dtype.is_bool() || dtype.is_temporal()