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

.implode + .over + .list.set_intersection PanicException left == right failed. #17132

Closed
2 tasks done
cmdlineluser opened this issue Jun 22, 2024 · 1 comment · Fixed by #17157
Closed
2 tasks done
Assignees
Labels
A-panic Area: code that results in panic exceptions accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@cmdlineluser
Copy link
Contributor

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": [1, 2, 2, 3, 3],
    "b": [2, 2, 4, 7, 8]
})

df.with_columns(
    pl.col("b").implode().over("a", mapping_strategy="join")
      .list.set_intersection([1])
)

# PanicException: assertion `left == right` failed
# left: LargeList(Field { name: "item", data_type: Int64, is_nullable: true, metadata: {} })
# right: Int64

Log output

thread 'polars-3' panicked at crates/polars-ops/src/chunked_array/list/sets.rs:367:5:
assertion `left == right` failed
  left: LargeList(Field { name: "item", data_type: Int64, is_nullable: true, metadata: {} })
 right: Int64

Issue description

Just while experimenting with the repro in #17129 I stumbled upon this panic.

I think it may be a slightly different issue as this also panics in 0.20.31

Expected behavior

Appropriate error instead of panic.

Installed versions

--------Version info---------
Polars:               1.0.0-beta.1
Index type:           UInt32
Platform:             macOS-13.6.1-arm64-arm-64bit
Python:               3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)]

----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.26.4
openpyxl:             <not installed>
pandas:               2.2.1
pyarrow:              15.0.2
pydantic:             <not installed>
pyiceberg:            <not installed>
sqlalchemy:           <not installed>
torch:                <not installed>
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@cmdlineluser cmdlineluser added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jun 22, 2024
@ruomad
Copy link

ruomad commented Jun 23, 2024

Hello,
This seems to be related to the double list generated by implode() which has been reported but seems to be intended (Cf. #10042)

If we flatten the result it works in 0.20.31, but fails as in #17129 in 1.0.0b1 :

df = pl.DataFrame({"a": [1, 2, 2, 3, 3], "b": [2, 2, 4, 7, 8]})
(df.with_columns(pl.col("b")
   .implode().over("a", mapping_strategy = 'join')
   .flatten().list.set_intersection([4, 8]))
)

@coastalwhite coastalwhite added the A-panic Area: code that results in panic exceptions label Jun 24, 2024
@ritchie46 ritchie46 self-assigned this Jun 24, 2024
@c-peters c-peters added the accepted Ready for implementation label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-panic Area: code that results in panic exceptions 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.

5 participants