From 6a48e6569198a2d0e93b8122362380192b02e4e3 Mon Sep 17 00:00:00 2001 From: ritchie Date: Fri, 7 Jun 2024 19:05:45 +0200 Subject: [PATCH 1/2] refactor: Don't enter streaming engine for groupby-> agg mean/median date --- .../src/executors/sinks/group_by/aggregates/convert.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 c3bc052d4b2a..dddcac3ba033 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 } From ac2b296d50a02c2a58839fae72ccefa6fbe14a40 Mon Sep 17 00:00:00 2001 From: ritchie Date: Sun, 9 Jun 2024 10:27:33 +0200 Subject: [PATCH 2/2] fix test --- py-polars/tests/unit/streaming/test_streaming_group_by.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2540cd7c0fd1..db9064c22ec6 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)],