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

Categorical hash only hashes underlying physical #21533

Open
2 tasks done
mcrumiller opened this issue Feb 28, 2025 · 0 comments
Open
2 tasks done

Categorical hash only hashes underlying physical #21533

mcrumiller opened this issue Feb 28, 2025 · 0 comments
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@mcrumiller
Copy link
Contributor

mcrumiller commented Feb 28, 2025

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Issue description

Hashes of categoricals only hash the underlying physical. Unless created with a global string cache, all categorical Series have physicals 0...n, and so will hash equivalently. This is probably not great behavior.

import polars as pl

pl.Series(["a"], dtype=pl.Categorical).hash() == pl.Series(["b"], dtype=pl.Categorical).hash()
# True

Installed versions

main

@mcrumiller mcrumiller added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

1 participant