Skip to content

Commit

Permalink
PERF-#7227: Call 'modin_frame.combine()' for merge and join only when…
Browse files Browse the repository at this point in the history
… necessary (#7228)

Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev authored Apr 27, 2024
1 parent f62f880 commit 5b96219
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modin/core/storage_formats/pandas/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def row_axis_merge(cls, left, right, kwargs):
left_index = kwargs.get("left_index", False)
right_index = kwargs.get("right_index", False)
sort = kwargs.get("sort", False)
right_to_broadcast = right._modin_frame.combine()

if how in ["left", "inner"] and left_index is False and right_index is False:
kwargs["sort"] = False
Expand Down Expand Up @@ -160,6 +159,7 @@ def map_func(
elif on is not None:
on = list(on) if is_list_like(on) else [on]

right_to_broadcast = right._modin_frame.combine()
new_columns, new_dtypes = cls._compute_result_metadata(
left, right, on, left_on, right_on, kwargs.get("suffixes", ("_x", "_y"))
)
Expand Down
2 changes: 1 addition & 1 deletion modin/core/storage_formats/pandas/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,13 @@ def join(self, right, **kwargs):
on = kwargs.get("on", None)
how = kwargs.get("how", "left")
sort = kwargs.get("sort", False)
right_to_broadcast = right._modin_frame.combine()

if how in ["left", "inner"]:

def map_func(left, right, kwargs=kwargs): # pragma: no cover
return pandas.DataFrame.join(left, right, **kwargs)

right_to_broadcast = right._modin_frame.combine()
new_self = self.__constructor__(
self._modin_frame.broadcast_apply_full_axis(
axis=1,
Expand Down

0 comments on commit 5b96219

Please sign in to comment.