Skip to content

Commit

Permalink
FIX-#7170: Don't use 'MinPartitionSize' configuration variable in rem…
Browse files Browse the repository at this point in the history
…ote context

Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed Apr 11, 2024
1 parent 2b046e4 commit 795cc6d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modin/core/dataframe/pandas/partitioning/axis_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import numpy as np
import pandas

from modin.config import MinPartitionSize

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'MinPartitionSize' is not used.
from modin.core.dataframe.base.partitioning.axis_partition import (
BaseDataframeAxisPartition,
)
Expand Down Expand Up @@ -392,6 +393,7 @@ def deploy_axis_func(
maintain_partitioning,
*partitions,
lengths=None,
min_block_size=None,
manual_partition=False,
return_generator=False,
):
Expand Down Expand Up @@ -473,10 +475,16 @@ def deploy_axis_func(
lengths = None
if return_generator:
return generate_result_of_axis_func_pandas(
axis, num_splits, result, lengths
axis,
num_splits,
result,
lengths,
min_block_size=min_block_size,
)
else:
return split_result_of_axis_func_pandas(axis, num_splits, result, lengths)
return split_result_of_axis_func_pandas(

Check warning on line 485 in modin/core/dataframe/pandas/partitioning/axis_partition.py

View check run for this annotation

Codecov / codecov/patch

modin/core/dataframe/pandas/partitioning/axis_partition.py#L485

Added line #L485 was not covered by tests
axis, num_splits, result, lengths, min_block_size=min_block_size
)

@classmethod
def deploy_func_between_two_axis_partitions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from distributed import Future
from distributed.utils import get_ip

from modin.config import MinPartitionSize

Check warning on line 20 in modin/core/execution/dask/implementations/pandas_on_dask/partitioning/virtual_partition.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/dask/implementations/pandas_on_dask/partitioning/virtual_partition.py#L20

Added line #L20 was not covered by tests
from modin.core.dataframe.pandas.partitioning.axis_partition import (
PandasDataframeAxisPartition,
)
Expand Down Expand Up @@ -161,6 +162,7 @@ def deploy_axis_func(
f_kwargs={
"lengths": lengths,
"manual_partition": manual_partition,
"min_block_size": MinPartitionSize.get(),
},
num_returns=result_num_splits * (1 + cls._PARTITIONS_METADATA_LEN),
pure=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import ray
from ray.util import get_node_ip_address

from modin.config import MinPartitionSize
from modin.core.dataframe.pandas.partitioning.axis_partition import (

Check warning on line 21 in modin/core/execution/ray/implementations/pandas_on_ray/partitioning/virtual_partition.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/ray/implementations/pandas_on_ray/partitioning/virtual_partition.py#L20-L21

Added lines #L20 - L21 were not covered by tests
PandasDataframeAxisPartition,
)
Expand Down Expand Up @@ -189,6 +190,7 @@ def deploy_axis_func(
f_kwargs=f_kwargs,
manual_partition=manual_partition,
lengths=lengths,
min_block_size=MinPartitionSize.get(),
return_generator=True,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import pandas
import unidist

from modin.config import MinPartitionSize
from modin.core.dataframe.pandas.partitioning.axis_partition import (
PandasDataframeAxisPartition,
)
Expand Down Expand Up @@ -189,6 +190,7 @@ def deploy_axis_func(
*partitions,
manual_partition=manual_partition,
lengths=lengths,
min_block_size=MinPartitionSize.get(),
)

@classmethod
Expand Down
1 change: 1 addition & 0 deletions modin/core/storage_formats/pandas/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def generate_result_of_axis_func_pandas(
length_list = get_length_list(
result.shape[axis], num_splits, min_block_size
)
# print(f"{length_list=}")
# Inserting the first "zero" to properly compute cumsum indexing slices
length_list = np.insert(length_list, obj=0, values=[0])
sums = np.cumsum(length_list)
Expand Down

0 comments on commit 795cc6d

Please sign in to comment.