Skip to content

Commit

Permalink
Fix groupby.agg bug with Timedelta (#2245)
Browse files Browse the repository at this point in the history
<!---
Please answer these questions before creating your pull request. Thanks!
--->

1. Which Jira issue is this PR addressing? Make sure that there is an
accompanying issue to your PR.

   <!---
   In this section, please add a Snowflake Jira issue number.
   
Note that if a corresponding GitHub issue exists, you should still
include
   the Snowflake Jira issue number. For example, for GitHub issue
#1400, you should
   add "SNOW-1335071" here.
    --->

   Fixes SNOW-NNNNNNN

2. Fill out the following pre-review checklist:

- [ ] I am adding a new automated test(s) to verify correctness of my
new code
- [ ] If this test skips Local Testing mode, I'm requesting review from
@snowflakedb/local-testing
   - [ ] I am adding new logging messages
   - [ ] I am adding a new telemetry message
   - [ ] I am adding new credentials
   - [ ] I am adding a new dependency
- [ ] If this is a new feature/behavior, I'm adding the Local Testing
parity changes.

3. Please describe how your code solves the related issue.

Please write a short description of how your code change solves the
related issue.

---------

Signed-off-by: Naren Krishna <[email protected]>
  • Loading branch information
sfc-gh-nkrishna authored Sep 6, 2024
1 parent 4fae315 commit 1df0eef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3580,8 +3580,9 @@ def convert_func_to_agg_func_info(
)
elif col_agg_func in GROUPBY_AGG_WITH_NONE_SNOWPARK_PANDAS_TYPES:
# In the case where the aggregation overrides the type of the output data column
# (e.g. any always returns boolean data columns), set the output Snowpark pandas type to None
new_data_column_snowpark_pandas_types = None # type: ignore
# (e.g. any always returns boolean data columns), set the output Snowpark pandas type
# of the given column to None
new_data_column_snowpark_pandas_types.append(None) # type: ignore
else:
self._raise_not_implemented_error_for_timedelta()
new_data_column_snowpark_pandas_types = None # type: ignore
Expand Down
6 changes: 6 additions & 0 deletions tests/integ/modin/groupby/test_groupby_basic_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,3 +1147,9 @@ def test_timedelta_groupby_agg():
native_df,
lambda df: df.groupby("B").agg({"A": ["sum", "median"], "C": "min"}),
)
with SqlCounter(query_count=1):
eval_snowpark_pandas_result(
snow_df,
native_df,
lambda df: df.groupby("B").agg({"A": ["sum", "count"], "C": "median"}),
)

0 comments on commit 1df0eef

Please sign in to comment.