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

Reorganize cudf_polars expression code #17014

Merged

Conversation

brandon-b-miller
Copy link
Contributor

This PR seeks to break up expr.py into a less unwieldy monolith.

@brandon-b-miller brandon-b-miller added feature request New feature or request non-breaking Non-breaking change cudf.polars Issues specific to cudf.polars labels Oct 8, 2024
@brandon-b-miller brandon-b-miller self-assigned this Oct 8, 2024
@brandon-b-miller brandon-b-miller requested a review from a team as a code owner October 8, 2024 13:59
@github-actions github-actions bot added the Python Affects Python cuDF API. label Oct 8, 2024
from polars.polars import _expr_nodes as pl_expr

from cudf_polars.containers import Column, NamedColumn
from cudf_polars.utils import dtypes, sorting
from cudf_polars.containers import Column
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep this file at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally a few of these didn't seem to have an obvious home, maybe a misc.py?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is useful to have everything importable from one place. So yes, I think it makes sense to keep this file.

I think it would be nice if all this file did was to import the expression names into the dsl.expr namespace.

So moving the remainder makes sense to me.

How about Cast into unary.py, Ternary into ternary.py and BooleanFunction into boolean.py?

Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @brandon-b-miller! This looks like a good step to me. Some small further suggestions.

from polars.polars import _expr_nodes as pl_expr

from cudf_polars.containers import Column, NamedColumn
from cudf_polars.utils import dtypes, sorting
from cudf_polars.containers import Column
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is useful to have everything importable from one place. So yes, I think it makes sense to keep this file.

I think it would be nice if all this file did was to import the expression names into the dsl.expr namespace.

So moving the remainder makes sense to me.

How about Cast into unary.py, Ternary into ternary.py and BooleanFunction into boolean.py?

Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changeset is large, so I assumed that this was a pure reorg with no material changes and reviewed it as such by just skimming what went into each file. Overall this is a definite improvement and I'd be fine merging it as is. Some of the module groupings might get harder to rationalize over time, though, and some of them are already a bit more tenuous than others. That makes me wonder if we should just go with one class per module. We're already most of the way there; a couple of modules have 2-3 classes, but that's about it. WDYT? I'm OK merging this either way.

Copy link
Contributor

@Matt711 Matt711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we merge this one before #17016?

@wence-
Copy link
Contributor

wence- commented Oct 11, 2024

/merge

@wence-
Copy link
Contributor

wence- commented Oct 11, 2024

Thanks Brandon!

@rapids-bot rapids-bot bot merged commit b8f3e21 into rapidsai:branch-24.12 Oct 11, 2024
102 checks passed
@brandon-b-miller brandon-b-miller deleted the cudf-polars-expr-reorg branch October 14, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cudf.polars Issues specific to cudf.polars feature request New feature or request non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants