Skip to content

arr.max() paniced in the latest release #15646

@eitsupi

Description

@eitsupi

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
pl.DataFrame({"foo": [[1, None], [1, 2], [None, None]]}).select(pl.col("foo").list.to_array(2).arr.max())

Log output

thread 'python3' panicked at crates/polars-arrow/src/bitmap/aligned.rs:115:48:
mid > len
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/rstudio/.local/lib/python3.10/site-packages/polars/dataframe/frame.py", line 7697, in select
    return self.lazy().select(*exprs, **named_exprs).collect(_eager=True)
  File "/home/rstudio/.local/lib/python3.10/site-packages/polars/lazyframe/frame.py", line 1708, in collect
    return wrap_df(ldf.collect())
pyo3_runtime.PanicException: mid > len

Issue description

This is strictly a bug in Rust, I noticed the panic in pola-rs/r-polars#1034 after updating to Rust Polars 0.39.0.

Expected behavior

Should not panicked.

Installed versions

--------Version info---------
Polars:               0.20.20
Index type:           UInt32
Platform:             Linux-5.15.146.1-microsoft-standard-WSL2-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>
hvplot:               <not installed>
matplotlib:           <not installed>
nest_asyncio:         <not installed>
numpy:                1.26.3
openpyxl:             <not installed>
pandas:               2.1.4
pyarrow:              15.0.0
pydantic:             <not installed>
pyiceberg:            <not installed>
pyxlsb:               <not installed>
sqlalchemy:           <not installed>
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>

Metadata

Metadata

Assignees

Labels

A-dtype-list/arrayArea: list/array data typeA-panicArea: code that results in panic exceptionsP-mediumPriority: mediumbugSomething isn't workingrustRelated to Rust Polars

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions