Skip to content

Commit c004dc4

Browse files
SNOW-2405552: Reuse row_count from the relaxed query compiler in get_axis_len() (#3878)
1 parent de86aa0 commit c004dc4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
- `str.endswith`
7171
- `str.slice`
7272
- `sort_values`
73+
- Reuse row count from the relaxed query compiler in `get_axis_len`.
7374

7475
#### Bug Fixes
7576

src/snowflake/snowpark/modin/plugin/compiler/snowflake_query_compiler.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10692,7 +10692,21 @@ def get_axis_len(
1069210692
-------
1069310693
Length of the specified axis.
1069410694
"""
10695-
return self._modin_frame.num_rows if axis == 0 else len(self.columns)
10695+
if axis == 0:
10696+
if (
10697+
self._relaxed_query_compiler is not None
10698+
and self._relaxed_query_compiler._modin_frame.ordered_dataframe.row_count
10699+
is not None
10700+
):
10701+
row_count = (
10702+
self._relaxed_query_compiler._modin_frame.ordered_dataframe.row_count
10703+
)
10704+
self._modin_frame.ordered_dataframe.row_count = row_count
10705+
return row_count
10706+
else:
10707+
return self._modin_frame.num_rows
10708+
else:
10709+
return len(self.columns)
1069610710

1069710711
def _nunique_columns(
1069810712
self, dropna: bool, include_index: bool = False

0 commit comments

Comments
 (0)