-
Notifications
You must be signed in to change notification settings - Fork 915
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
Remove cudf._lib.transform in favor of inlining pylibcudf #17505
Merged
rapids-bot
merged 7 commits into
rapidsai:branch-25.02
from
mroeschke:cudf/_lib/transform
Dec 9, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d7484d3
Remove cudf._lib.transform in favor of inlining pylibcudf
mroeschke 3bb7a4d
Merge remote-tracking branch 'upstream/branch-25.02' into cudf/_lib/t…
mroeschke 0cafeb6
Merge branch 'branch-25.02' into cudf/_lib/transform
mroeschke 294ec92
Merge branch 'branch-25.02' into cudf/_lib/transform
mroeschke 97901ce
Merge remote-tracking branch 'upstream/branch-25.02' into cudf/_lib/t…
mroeschke efd632e
Merge branch 'cudf/_lib/transform' of https://github.com/mroeschke/cu…
mroeschke b09d9b5
Merge remote-tracking branch 'upstream/branch-25.02' into cudf/_lib/t…
mroeschke 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 was deleted.
Oops, something went wrong.
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 | ||||
---|---|---|---|---|---|---|
|
@@ -6772,9 +6772,7 @@ def _apply_cupy_method_axis_1(self, method, *args, **kwargs): | |||||
) | ||||||
result = column.as_column(result, dtype=result_dtype) | ||||||
if mask is not None: | ||||||
result = result.set_mask( | ||||||
cudf._lib.transform.bools_to_mask(mask._column) | ||||||
) | ||||||
result = result.set_mask(mask._column.as_mask()) | ||||||
return Series._from_column(result, index=self.index) | ||||||
else: | ||||||
result_df = DataFrame(result, index=self.index) | ||||||
|
@@ -7883,6 +7881,16 @@ def interleave_columns(self): | |||||
) | ||||||
return self._constructor_sliced._from_column(result_col) | ||||||
|
||||||
@acquire_spill_lock() | ||||||
def _compute_columns(self, expr: str) -> ColumnBase: | ||||||
plc_column = plc.transform.compute_column( | ||||||
plc.Table( | ||||||
[col.to_pylibcudf(mode="read") for col in self._columns] | ||||||
), | ||||||
plc.expressions.to_expression(expr, self._column_names), | ||||||
) | ||||||
return libcudf.column.Column.from_pylibcudf(plc_column) | ||||||
|
||||||
@_performance_tracking | ||||||
def eval(self, expr: str, inplace: bool = False, **kwargs): | ||||||
"""Evaluate a string describing operations on DataFrame columns. | ||||||
|
@@ -8010,11 +8018,7 @@ def eval(self, expr: str, inplace: bool = False, **kwargs): | |||||
raise ValueError( | ||||||
"Cannot operate inplace if there is no assignment" | ||||||
) | ||||||
return Series._from_column( | ||||||
libcudf.transform.compute_column( | ||||||
[*self._columns], self._column_names, statements[0] | ||||||
) | ||||||
) | ||||||
return Series._from_column(self._compute_columns(statements[0])) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
targets = [] | ||||||
exprs = [] | ||||||
|
@@ -8030,15 +8034,9 @@ def eval(self, expr: str, inplace: bool = False, **kwargs): | |||||
targets.append(t.strip()) | ||||||
exprs.append(e.strip()) | ||||||
|
||||||
cols = ( | ||||||
libcudf.transform.compute_column( | ||||||
[*self._columns], self._column_names, e | ||||||
) | ||||||
for e in exprs | ||||||
) | ||||||
ret = self if inplace else self.copy(deep=False) | ||||||
for name, col in zip(targets, cols): | ||||||
ret._data[name] = col | ||||||
for name, expr in zip(targets, exprs): | ||||||
ret._data[name] = self._compute_columns(expr) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if not inplace: | ||||||
return ret | ||||||
|
||||||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
Suggesting because it returns one column
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.
Sure, that makes sense. I'll incorporate this in another PR just to save a CI run
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.
I incorporated it in #17456