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

Panick since first release candidate when expressions in select() return a different number of rows #17308

Closed
2 tasks done
etiennebacher opened this issue Jun 30, 2024 · 3 comments · Fixed by #17320
Closed
2 tasks done
Assignees
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@etiennebacher
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 os
os.environ["POLARS_VERBOSE"] = "1"
import polars as pl

df = pl.DataFrame({
  "A": [1, 2],
  "B": [3, 4],
  "grp": ["A", "B"]
})

df.select(
  pl.col("A").sum(),
  pl.col("B").sum().over("grp")
)

Log output

thread '<unnamed>' panicked at crates/polars-mem-engine/src/executors/projection_utils.rs:120:38:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/etienne/.local/lib/python3.10/site-packages/polars/dataframe/frame.py", line 8499, in select
    return self.lazy().select(*exprs, **named_exprs).collect(_eager=True)
  File "/home/etienne/.local/lib/python3.10/site-packages/polars/lazyframe/frame.py", line 1909, in collect
    return wrap_df(ldf.collect(callback))
pyo3_runtime.PanicException: called `Option::unwrap()` on a `None` value

Issue description

This worked in 0.20.31.

Expected behavior

shape: (2, 2)
┌─────┬─────┐
│ A   ┆ B   │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 3   ┆ 3   │
│ 3   ┆ 4   │
└─────┴─────┘

Installed versions

--------Version info---------
Polars:               1.0.0-rc.2
Index type:           UInt32
Platform:             Linux-6.5.0-41-generic-x86_64-with-glibc2.35
Python:               3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            <not installed>
fastexcel:            <not installed>
fsspec:               <not installed>
gevent:               <not installed>
great_tables:         <not installed>
hvplot:               <not installed>
matplotlib:           <not installed>
nest_asyncio:         <not installed>
numpy:                1.21.5
openpyxl:             <not installed>
pandas:               <not installed>
pyarrow:              <not installed>
pydantic:             <not installed>
pyiceberg:            <not installed>
sqlalchemy:           <not installed>
torch:                <not installed>
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@etiennebacher etiennebacher added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jun 30, 2024
@etiennebacher etiennebacher changed the title Panick since first release candidate when statements in select() return a different number of rows Panick since first release candidate when expressions in select() return a different number of rows Jun 30, 2024
@MarcoGorelli
Copy link
Collaborator

thanks @etiennebacher for the report

from git bisect, this is due to #16688 - going to ping @coastalwhite then (no blame of course! 🤗 )

@coastalwhite coastalwhite self-assigned this Jul 1, 2024
@etiennebacher
Copy link
Author

Worth noting that I noticed this because the README example fails, so it's related to #17309

@ritchie46
Copy link
Member

I will take this one.

@coastalwhite coastalwhite removed their assignment Jul 1, 2024
@ritchie46 ritchie46 self-assigned this Jul 1, 2024
@c-peters c-peters added the accepted Ready for implementation label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants