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

Open
wants to merge 1 commit into
base: branch-24.12
Choose a base branch
from

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?

from collections.abc import Mapping

from cudf_polars.containers import DataFrame

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: throughout, can we advertise __all__?

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
None yet
Development

Successfully merging this pull request may close these issues.

2 participants