-
Notifications
You must be signed in to change notification settings - Fork 655
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
FEAT-#5367: Introduce new API for repartitioning Modin objects #5366
Merged
vnlitvinov
merged 21 commits into
modin-project:master
from
anmyachev:add-repartition-api
Dec 10, 2022
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ed9ebe5
FEAT-#0000: introduce repartition api for modin.utils
anmyachev a8ed713
add test and improve func
anmyachev b08fcdd
fixes
anmyachev a58a7f3
mute mypy
anmyachev 66d97c9
move repartition into modin.distributed.dataframe.pandas module
anmyachev 103cc24
fix
anmyachev 54c0597
fix
anmyachev 09e99e9
add fast path for hdk
anmyachev 77e5199
add note into docs
anmyachev 0b81388
make repartition as internal method of DataFrame and Series
anmyachev 6ba2dea
address review comments
anmyachev 1ff556f
address review comments
anmyachev 050749a
use test_repartition.py in CI
anmyachev 830fa08
Apply suggestions from code review
anmyachev e3ae362
Update modin/pandas/base.py
anmyachev 8f67b13
address review comments
anmyachev 66b0e12
fixes
anmyachev 1092b3e
doc fixes
anmyachev f101c6b
align amount of partitions with the rest of test files
anmyachev 37c7db6
Apply suggestions from code review
anmyachev 72552df
add explaining of axis parameter
anmyachev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Licensed to Modin Development Team under one or more contributor license agreements. | ||
# See the NOTICE file distributed with this work for additional information regarding | ||
# copyright ownership. The Modin Development Team licenses this file to you under the | ||
# Apache License, Version 2.0 (the "License"); you may not use this file except in | ||
# compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under | ||
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF | ||
# ANY KIND, either express or implied. See the License for the specific language | ||
# governing permissions and limitations under the License. | ||
|
||
import pytest | ||
|
||
import modin.pandas as pd | ||
anmyachev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
from modin.config import NPartitions | ||
|
||
NPartitions.put(4) | ||
YarShev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
@pytest.mark.parametrize("axis", [0, 1, None]) | ||
@pytest.mark.parametrize("dtype", ["DataFrame", "Series"]) | ||
def test_repartition(axis, dtype): | ||
if axis in (1, None) and dtype == "Series": | ||
# no sense for Series | ||
return | ||
|
||
df = pd.DataFrame({"col1": [1, 2], "col2": [5, 6]}) | ||
df2 = pd.DataFrame({"col3": [9, 4]}) | ||
|
||
df = pd.concat([df, df2], axis=1) | ||
df = pd.concat([df, df], axis=0) | ||
|
||
obj = df if dtype == "DataFrame" else df["col1"] | ||
|
||
source_shapes = { | ||
"DataFrame": (2, 2), | ||
"Series": (2, 1), | ||
} | ||
# check that the test makes sense | ||
assert obj._query_compiler._modin_frame._partitions.shape == source_shapes[dtype] | ||
|
||
kwargs = {"axis": axis} if dtype == "DataFrame" else {} | ||
obj = obj._repartition(**kwargs) | ||
|
||
if dtype == "DataFrame": | ||
results = { | ||
None: (1, 1), | ||
0: (1, 2), | ||
1: (2, 1), | ||
} | ||
else: | ||
results = { | ||
None: (1, 1), | ||
0: (1, 1), | ||
1: (2, 1), | ||
} | ||
|
||
assert obj._query_compiler._modin_frame._partitions.shape == results[axis] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has not been tested before when pushing, which affects the stability of
codecov
results.