@@ -3255,7 +3255,6 @@ def broadcast_apply(
3255
3255
axis ,
3256
3256
other ,
3257
3257
join_type ,
3258
- sort = not self .get_axis (axis ).equals (other .get_axis (axis )),
3259
3258
)
3260
3259
# unwrap list returned by `copartition`.
3261
3260
right_parts = right_parts [0 ]
@@ -3681,7 +3680,7 @@ def _check_if_axes_identical(self, other: PandasDataframe, axis: int = 0) -> boo
3681
3680
) and self ._get_axis_lengths (axis ) == other ._get_axis_lengths (axis )
3682
3681
3683
3682
def _copartition (
3684
- self , axis , other , how , sort , force_repartition = False , fill_value = None
3683
+ self , axis , other , how , sort = None , force_repartition = False , fill_value = None
3685
3684
):
3686
3685
"""
3687
3686
Copartition two Modin DataFrames.
@@ -3696,8 +3695,9 @@ def _copartition(
3696
3695
Other Modin DataFrame(s) to copartition against.
3697
3696
how : str
3698
3697
How to manage joining the index object ("left", "right", etc.).
3699
- sort : bool
3698
+ sort : bool, default: None
3700
3699
Whether sort the joined index or not.
3700
+ If ``None``, sort is defined in depend on labels equality along the axis.
3701
3701
force_repartition : bool, default: False
3702
3702
Whether force the repartitioning or not. By default,
3703
3703
this method will skip repartitioning if it is possible. This is because
@@ -3730,6 +3730,9 @@ def _copartition(
3730
3730
self ._get_axis_lengths_cache (axis ),
3731
3731
)
3732
3732
3733
+ if sort is None :
3734
+ sort = not all (self .get_axis (axis ).equals (o .get_axis (axis )) for o in other )
3735
+
3733
3736
self_index = self .get_axis (axis )
3734
3737
others_index = [o .get_axis (axis ) for o in other ]
3735
3738
joined_index , make_reindexer = self ._join_index_objects (
@@ -3823,6 +3826,7 @@ def n_ary_op(
3823
3826
op ,
3824
3827
right_frames : list [PandasDataframe ],
3825
3828
join_type = "outer" ,
3829
+ sort = None ,
3826
3830
copartition_along_columns = True ,
3827
3831
labels = "replace" ,
3828
3832
dtypes : Optional [pandas .Series ] = None ,
@@ -3838,6 +3842,8 @@ def n_ary_op(
3838
3842
Modin DataFrames to join with.
3839
3843
join_type : str, default: "outer"
3840
3844
Type of join to apply.
3845
+ sort : bool, default: None
3846
+ Whether to sort index and columns or not.
3841
3847
copartition_along_columns : bool, default: True
3842
3848
Whether to perform copartitioning along columns or not.
3843
3849
For some ops this isn't needed (e.g., `fillna`).
@@ -3854,7 +3860,10 @@ def n_ary_op(
3854
3860
New Modin DataFrame.
3855
3861
"""
3856
3862
left_parts , list_of_right_parts , joined_index , row_lengths = self ._copartition (
3857
- 0 , right_frames , join_type , sort = True
3863
+ 0 ,
3864
+ right_frames ,
3865
+ join_type ,
3866
+ sort = sort ,
3858
3867
)
3859
3868
if copartition_along_columns :
3860
3869
new_left_frame = self .__constructor__ (
@@ -3886,7 +3895,7 @@ def n_ary_op(
3886
3895
1 ,
3887
3896
new_right_frames ,
3888
3897
join_type ,
3889
- sort = True ,
3898
+ sort = sort ,
3890
3899
)
3891
3900
else :
3892
3901
joined_columns = self .copy_columns_cache (copy_lengths = True )
@@ -3978,7 +3987,7 @@ def _compute_new_widths():
3978
3987
joined_index ,
3979
3988
partition_sizes_along_axis ,
3980
3989
) = self ._copartition (
3981
- axis .value ^ 1 , others , how , sort , force_repartition = False
3990
+ axis .value ^ 1 , others , how , sort = sort , force_repartition = False
3982
3991
)
3983
3992
if axis == Axis .COL_WISE :
3984
3993
new_lengths = partition_sizes_along_axis
0 commit comments