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

Combination of when-then statement with over and mapping_strategy="join" runs forever #20749

Open
2 tasks done
ElisabethBrockhausQC opened this issue Jan 16, 2025 · 0 comments
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@ElisabethBrockhausQC
Copy link

Checks

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

Reproducible example

import polars as pl

df = pl.DataFrame(
    {"a": [True, True], "b": ["foo", "bar"], "c": [1, 2]},
    schema={"a": pl.Boolean, "b": pl.String, "c": pl.UInt16},
)

df.with_columns(
    pl.when(pl.col("a"))
    .then(pl.col("b").over("c", mapping_strategy="join"))
    .otherwise(pl.col("b"))
    .alias("d")
)

Log output

Issue description

The given code example runs forever.

Expected behavior

We would expect some kind of exception indicating that the schema of the expressions in .then() and in .otherwise() are not compatible.

Installed versions

--------Version info---------
Polars:              1.16.0
Index type:          UInt32
Platform:            macOS-15.2-arm64-arm-64bit
Python:              3.12.7 | packaged by conda-forge | (main, Oct  4 2024, 15:57:01) [Clang 17.0.6 ]
LTS CPU:             False

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               5.5.0
boto3                1.35.73
cloudpickle          3.1.0
connectorx           <not installed>
deltalake            <not installed>
fastexcel            0.12.0
fsspec               2024.10.0
gevent               <not installed>
google.auth          2.36.0
great_tables         <not installed>
matplotlib           3.9.3
nest_asyncio         1.6.0
numpy                1.26.4
openpyxl             3.1.5
pandas               2.2.3
pyarrow              18.1.0
pydantic             2.10.3
pyiceberg            <not installed>
sqlalchemy           2.0.35
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           3.2.0
@ElisabethBrockhausQC ElisabethBrockhausQC added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jan 16, 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