Skip to content

Expr.rechunk does not rechunk in with_columns #22262

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

Open
2 tasks done
mcrumiller opened this issue Apr 14, 2025 · 0 comments · May be fixed by #22265
Open
2 tasks done

Expr.rechunk does not rechunk in with_columns #22262

mcrumiller opened this issue Apr 14, 2025 · 0 comments · May be fixed by #22265
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 Apr 14, 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

Using a modified example from the docs, if we replace .select with .with_columns we do not get a rechunked series:

import polars as pl
from polars import col

df = pl.DataFrame({"a": [1, 2]})
df = df.select(pl.repeat(None, 1).append(col("a")))
# shape: (3, 1)
# ┌────────┐
# │ repeat │
# │ ---    │
# │ i64    │
# ╞════════╡
# │ null   │ <-- chunk 1
# │ 1      │ <-- chunk 2
# │ 2      │
# └────────┘

df.select(col("repeat").rechunk()).n_chunks()
# 1

df.with_columns(col("repeat").rechunk()).n_chunks()
# 2

Installed versions

main

@mcrumiller mcrumiller added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Apr 14, 2025
@mcrumiller mcrumiller linked a pull request Apr 14, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant