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

feat(rust,python): add dedicated name namespace for operations that affect expression names #11973

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Oct 24, 2023

Closes #11639.

As per discussion on the linked issue, this PR moves the following name-related expressions into a dedicated/new name namespace in Python and creates an equivalent namespace in Rust where these related expressions (and any future ones) can live:

Moved

  • keep_name()name.keep()
  • map_alias()name.map()
  • prefix()name.prefix()
  • suffix()name.suffix()

New

Now that the dedicated namespace exists (so there will be no confusion with the equivalent str.to_* methods), have also added the following new expressions:

  • name.to_lowercase()
  • name.to_uppercase()

Deprecation

  • 🐍 Python: everything is gracefully deprecated as usual (will generate a warning).
  • 🦀 Rust: will break existing usage of keep_name, suffix, prefix, map_alias; existing code will need to be updated to point at the relocated expressions in the new name expressions.

Misc

  • Added new name namespace docs and tests, updated examples & user guide, etc.
  • Minor tweak to avoid having both "name" & "names" modules in polars-plan/dsl; moved the one-line entry for COUNT into "consts" instead.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Oct 24, 2023
@alexander-beedie alexander-beedie marked this pull request as ready for review October 24, 2023 13:08
@alexander-beedie alexander-beedie changed the title feat(python): add dedicated name namespace for operations that affect expression names feat(rust,python): add dedicated name namespace for operations that affect expression names Oct 24, 2023
@github-actions github-actions bot added the rust Related to Rust Polars label Oct 24, 2023
@ritchie46
Copy link
Member

Nice! We need to wait merging this until the rust release is patched. But good to make it more meta.

@alexander-beedie
Copy link
Collaborator Author

Nice! We need to wait merging this until the rust release is patched. But good to make it more meta.

No problem; I'll keep it actively rebased (since it hits a lot of files!) until it's ready to roll ;)

@ritchie46
Copy link
Member

Actually, the rust build is broken. We can merge this. :)

@ritchie46 ritchie46 merged commit ffb22ac into pola-rs:main Oct 25, 2023
32 checks passed
@alexander-beedie alexander-beedie deleted the new-expression-name-namespace branch October 25, 2023 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding a new .name expression namespace
2 participants