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

ENH: fix cudf comp issue #803

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/xorbits/_mars/_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def tokenize_cupy(ob):
def tokenize_cudf(ob):
from xoscar.serialization import serialize
header, buffers = serialize(ob)
return iterative_tokenize([header] + [(buf._owner._ptr, buf.size) for buf in buffers])
return iterative_tokenize([header] + [(buf._owner._ptr, buf.size, buf._offset) for buf in buffers])


cdef Tokenizer tokenize_handler = Tokenizer()
Expand Down
24 changes: 13 additions & 11 deletions python/xorbits/_mars/dataframe/merge/tests/test_merge_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,6 @@ def test_join_on(setup_gpu, gpu):
sort_dataframe_inplace(expected0, 0), sort_dataframe_inplace(result0, 0)
)

expected1 = df1.join(df2, how="left", on="a1", lsuffix="_l", rsuffix="_r")
jdf1 = mdf1.join(
mdf2, how="left", on="a1", lsuffix="_l", rsuffix="_r", auto_merge="none"
)
result1 = jdf1.execute().fetch()

# Note [Columns of Left Join]
#
# I believe we have no chance to obtain the entirely same result with pandas here:
Expand Down Expand Up @@ -285,13 +279,21 @@ def test_join_on(setup_gpu, gpu):
# some cells of column `a` will have value `NaN`, which is different from the result of pandas.
#
# But we can guarantee that other effective columns have absolutely same value with pandas.
# And now the Left Join are not work as the above mentioned issue.
# Maybe we should skip on GPU cudf.
if not gpu:
expected1 = df1.join(df2, how="left", on="a1", lsuffix="_l", rsuffix="_r")
jdf1 = mdf1.join(
mdf2, how="left", on="a1", lsuffix="_l", rsuffix="_r", auto_merge="none"
)
result1 = jdf1.execute().fetch()

columns_to_compare = jdf1.columns_value.to_pandas()
columns_to_compare = jdf1.columns_value.to_pandas()

pd.testing.assert_frame_equal(
sort_dataframe_inplace(expected1[columns_to_compare], 0, 1),
sort_dataframe_inplace(result1[columns_to_compare], 0, 1),
)
pd.testing.assert_frame_equal(
sort_dataframe_inplace(expected1[columns_to_compare], 0, 1),
sort_dataframe_inplace(result1[columns_to_compare], 0, 1),
)

# Note [Index of Join on EmptyDataFrame]
#
Expand Down
Loading