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

InvalidOperationError when using fill_null after .list.sum() on bool list #16256

Closed
2 tasks done
0xbe7a opened this issue May 15, 2024 · 0 comments · Fixed by #16290
Closed
2 tasks done

InvalidOperationError when using fill_null after .list.sum() on bool list #16256

0xbe7a opened this issue May 15, 2024 · 0 comments · Fixed by #16290
Assignees
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@0xbe7a
Copy link
Contributor

0xbe7a commented May 15, 2024

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({"x": [[True, True, False]]})


df.select(
    pl.col("x")
    .list.sum()
    .fill_null(0)
)

Log output

Traceback (most recent call last):
  File "/Users/belastoyan/Documents/[redacted]/test.py", line 8, in <module>
    df.select(
  File "/Users/belastoyan/Documents/[redacted]]/.pixi/envs/default/lib/python3.12/site-packages/polars/dataframe/frame.py", line 8137, in select
    return self.lazy().select(*exprs, **named_exprs).collect(_eager=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/belastoyan/Documents/[redacted]/.pixi/envs/default/lib/python3.12/site-packages/polars/lazyframe/frame.py", line 1816, in collect
    return wrap_df(ldf.collect(callback))
                   ^^^^^^^^^^^^^^^^^^^^^
polars.exceptions.InvalidOperationError: could not determine supertype of: [bool, dyn int]

Issue description

This used to work on polars 0.20.25, now it's throwing an error. I believe it's a valid expression.

Expected behavior

Should output 2

Installed versions

--------Version info---------
Polars: 0.20.26
Index type: UInt32
Platform: macOS-14.4-arm64-arm-64bit
Python: 3.12.3 | packaged by conda-forge | (main, Apr 15 2024, 18:35:20) [Clang 16.0.6 ]

----Optional dependencies----
adbc_driver_manager:
cloudpickle:
connectorx:
deltalake:
fastexcel:
fsspec:
gevent:
hvplot:
matplotlib:
nest_asyncio: 1.6.0
numpy: 1.26.4
openpyxl:
pandas: 2.2.2
pyarrow: 16.0.0
pydantic:
pyiceberg:
pyxlsb:
sqlalchemy:
torch:
xlsx2csv:
xlsxwriter:

@0xbe7a 0xbe7a added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels May 15, 2024
@ritchie46 ritchie46 self-assigned this May 17, 2024
@c-peters c-peters added the accepted Ready for implementation label May 21, 2024
@c-peters c-peters added this to Backlog May 21, 2024
@c-peters c-peters moved this to Done in Backlog May 21, 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
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants