Skip to content

Commit

Permalink
FIX-#6479: HDK CalciteBuilder: Do not call is_bool_dtype() for catego…
Browse files Browse the repository at this point in the history
…rical (#6480)

Signed-off-by: Andrey Pavlenko <[email protected]>
  • Loading branch information
AndreyPavlenko authored Aug 18, 2023
1 parent 8ffc281 commit 781fed8
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 781fed8

Please sign in to comment.