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

read_parquet([files], ..., use_pyarrow=False) fails when reading multiple files with different schema #13438

Closed
2 tasks done
mcrumiller opened this issue Jan 4, 2024 · 1 comment · Fixed by #17321
Closed
2 tasks done
Assignees
Labels
A-io-parquet Area: reading/writing Parquet files accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@mcrumiller
Copy link
Contributor

mcrumiller commented Jan 4, 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
from pathlib import Path

pl.DataFrame({
    "a": [1, 2, 3],
    "b": [1, 2, 3] ,
}).write_parquet("df1.pqt")

pl.DataFrame({
    "a": [4, 5, 6],
    "c": [4, 5, 6],
}).write_parquet("df2.pqt")

pl.read_parquet(["df1.pqt", "df2.pqt"], use_pyarrow=True)   # succeeds
pl.read_parquet(["df1.pqt", "df2.pqt"], use_pyarrow=False)  # fails

Log output

thread '<unnamed>' panicked at polars/crates/polars-parquet/src/arrow/read/deserialize/mod.rs:141:31:
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 "polars/py-polars/scripts/check_pq.py", line 14, in <module>
    pl.read_parquet(["df1.pqt", "df2.pqt"], columns=["a"], use_pyarrow=False)
  File "polars/py-polars/polars/io/parquet/functions.py", line 183, in read_parquet
    return lf.collect(no_optimization=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mcrumiller/projects/polars/py-polars/polars/lazyframe/frame.py", line 1749, in collect
    return wrap_df(ldf.collect())
                   ^^^^^^^^^^^^^
pyo3_runtime.PanicException: called `Option::unwrap()` on a `None` value

Issue description

More general description of ##13436. When providing pyarrow=False, read_parquet fails when pyarrow is not used.

Expected behavior

Should return df with single column a since this is the only column column to both parquet files.

Installed versions

--------Version info---------
Polars:               0.20.3
Index type:           UInt32
Platform:             Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
Python:               3.11.3 (main, Apr 15 2023, 14:44:51) [GCC 11.3.0]

----Optional dependencies----
adbc_driver_manager:  0.8.0
cloudpickle:          3.0.0
connectorx:           0.3.2
deltalake:            0.15.0
fsspec:               2023.12.2
gevent:               23.9.1
hvplot:               0.9.1
matplotlib:           3.8.2
numpy:                1.26.3
openpyxl:             3.1.2
pandas:               2.1.4
pyarrow:              14.0.2
pydantic:             2.5.3
pyiceberg:            0.5.1
pyxlsb:               1.0.10
sqlalchemy:           2.0.25
xlsx2csv:             0.8.1
xlsxwriter:           3.1.9
@ion-elgreco
Copy link
Contributor

I proposed something related to this: #13086

@stinodego stinodego added the needs triage Awaiting prioritization by a maintainer label Jan 13, 2024
@stinodego stinodego added the A-io-parquet Area: reading/writing Parquet files label Jan 21, 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
A-io-parquet Area: reading/writing Parquet files 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