From 67e0af35d4eb98b94c1aa17b3e7b9a9ab08af792 Mon Sep 17 00:00:00 2001 From: Ritchie Vink Date: Sun, 9 Jun 2024 10:50:09 +0200 Subject: [PATCH] =?UTF-8?q?refactor:=20Don't=20enter=20streaming=20engine?= =?UTF-8?q?=20for=20groupby->=20agg=20mean/median=20=E2=80=A6=20(#16810)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/executors/sinks/group_by/aggregates/convert.rs | 7 ++++++- py-polars/tests/unit/streaming/test_streaming_group_by.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/convert.rs b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/convert.rs index c3bc052d4b2a2..dddcac3ba033c 100644 --- a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/convert.rs +++ b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/convert.rs @@ -101,7 +101,12 @@ pub fn can_convert_to_hash_agg( } ) && { if let Ok(field) = ae.to_field(input_schema, Context::Default, expr_arena) { - field.dtype.to_physical().is_numeric() + match field.dtype { + DataType::Date => { + matches!(agg_fn, IRAggExpr::Mean(_) | IRAggExpr::Median(_)) + }, + _ => field.dtype.to_physical().is_numeric(), + } } else { false } diff --git a/py-polars/tests/unit/streaming/test_streaming_group_by.py b/py-polars/tests/unit/streaming/test_streaming_group_by.py index 2540cd7c0fd1a..db9064c22ec6c 100644 --- a/py-polars/tests/unit/streaming/test_streaming_group_by.py +++ b/py-polars/tests/unit/streaming/test_streaming_group_by.py @@ -103,7 +103,7 @@ def test_streaming_group_by_types() -> None: "bool_last": [False], "bool_mean": [0.5], "bool_sum": [1], - "date_sum": [date(2074, 1, 1)], + "date_sum": [None], # Date streaming mean/median has been temporarily disabled # "date_mean": [date(2022, 1, 1)], "date_first": [date(2022, 1, 1)],