Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT-#6942: Enable range-partitioning impl for 'groupby().rolling()' by default #6943

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 22 additions & 15 deletions modin/core/storage_formats/pandas/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3993,23 +3993,30 @@
else:
assert callable(agg_func)

if unsupported_groupby:
obj = super(PandasQueryCompiler, self)
else:
obj = self

return obj.groupby_agg(
by=by,
agg_func=lambda grp, *args, **kwargs: agg_func(
kwargs = {
"by": by,
"agg_func": lambda grp, *args, **kwargs: agg_func(
grp.rolling(**rolling_kwargs), *args, **kwargs
),
axis=axis,
groupby_kwargs=groupby_kwargs,
agg_args=agg_args,
agg_kwargs=agg_kwargs,
how="direct",
drop=drop,
)
"axis": axis,
"groupby_kwargs": groupby_kwargs,
"agg_args": agg_args,
"agg_kwargs": agg_kwargs,
"how": "direct",
"drop": drop,
}

if unsupported_groupby:
return super(PandasQueryCompiler, self).groupby_agg(**kwargs)

try:
return self._groupby_shuffle(**kwargs)
except NotImplementedError as e:
get_logger().info(

Check warning on line 4015 in modin/core/storage_formats/pandas/query_compiler.py

View check run for this annotation

Codecov / codecov/patch

modin/core/storage_formats/pandas/query_compiler.py#L4014-L4015

Added lines #L4014 - L4015 were not covered by tests
f"Can't use range-partitioning groupby implementation because of: {e}"
+ "\nFalling back to a full-axis implementation."
)
return self.groupby_agg(**kwargs)

Check warning on line 4019 in modin/core/storage_formats/pandas/query_compiler.py

View check run for this annotation

Codecov / codecov/patch

modin/core/storage_formats/pandas/query_compiler.py#L4019

Added line #L4019 was not covered by tests

def groupby_agg(
self,
Expand Down