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

PERF-#6716: Avoid materializing axes in _filter_empties #6717

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions modin/core/dataframe/pandas/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,15 +741,19 @@ def _filter_empties(self, compute_metadata=True):
Trigger the computations for partition sizes and labels if they're not done already.
"""
if not compute_metadata and (
not self.has_materialized_index
or not self.has_materialized_columns
or self._row_lengths_cache is None
or self._column_widths_cache is None
self._row_lengths_cache is None or self._column_widths_cache is None
):
# do not trigger the computations
return

if len(self.axes[0]) == 0 or len(self.axes[1]) == 0:
if (
self.has_materialized_index
and len(self.index) == 0
or self.has_materialized_columns
and len(self.columns) == 0
or sum(self.row_lengths) == 0
or sum(self.column_widths) == 0
):
# This is the case for an empty frame. We don't want to completely remove
# all metadata and partitions so for the moment, we won't prune if the frame
# is empty.
Expand Down
Loading