Skip to content
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

FIX-#0000: make sure pickling is zero-copy for Ray #6691

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,9 @@ def split_pandas_df_into_partitions(
parts = [
[
update_bar(
put_func(col_part.iloc[i : i + row_chunksize]),
put_func(
col_part.iloc[i : i + row_chunksize].copy()
), # `copy()` to fix zero-copy pickling
)
for col_part in col_parts
]
Expand Down
20 changes: 20 additions & 0 deletions modin/test/storage_formats/pandas/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1511,3 +1511,23 @@ def assert_materialized(obj):

assert call_queue == reconstructed_queue
assert_everything_materialized(reconstructed_queue)


@pytest.mark.skipif(Engine.get() != "Ray", reason="Ray specific")
def test_zero_copy_pickling():
import ray

df = pd.DataFrame(np.zeros((100, 100)))
part = ray.get(df._query_compiler._modin_frame._partitions[0][0]._data)

try:
part.values[0, 0] = 10
except ValueError as err:
if "assignment destination is read-only" in str(err):
pass
else:
# Unexpected exception
raise err
else:
# The exception must be thrown
raise RuntimeError("not zero copy pickling")