From 781fed8152a6e0a6fcae9cab5604644577103a5f Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Fri, 18 Aug 2023 16:22:34 +0200 Subject: [PATCH] FIX-#6479: HDK CalciteBuilder: Do not call is_bool_dtype() for categorical (#6480) Signed-off-by: Andrey Pavlenko --- .../implementations/hdk_on_native/calcite_builder.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modin/experimental/core/execution/native/implementations/hdk_on_native/calcite_builder.py b/modin/experimental/core/execution/native/implementations/hdk_on_native/calcite_builder.py index 59eca9118bc..4e178708169 100644 --- a/modin/experimental/core/execution/native/implementations/hdk_on_native/calcite_builder.py +++ b/modin/experimental/core/execution/native/implementations/hdk_on_native/calcite_builder.py @@ -45,7 +45,7 @@ ) from collections import abc -from pandas.core.dtypes.common import get_dtype, is_bool_dtype +from pandas.core.dtypes.common import get_dtype, is_categorical_dtype, is_bool_dtype class CalciteBuilder: @@ -906,7 +906,10 @@ def _process_groupby(self, op): bool_cols := { c: cast_agg[agg_exprs[c].agg] for c, t in frame.dtypes.items() - if is_bool_dtype(t) and agg_exprs[c].agg in cast_agg + # Do not call is_bool_dtype() for categorical since it checks all the categories + if not is_categorical_dtype(t) + and is_bool_dtype(t) + and agg_exprs[c].agg in cast_agg } ): trans = self._input_ctx()._maybe_copy_and_translate_expr