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

Can't read empty categorical column inside a parquet file #5655

Closed
2 tasks done
Vincenthays opened this issue Nov 28, 2022 · 0 comments · Fixed by jorgecarleitao/arrow2#1312
Closed
2 tasks done

Can't read empty categorical column inside a parquet file #5655

Vincenthays opened this issue Nov 28, 2022 · 0 comments · Fixed by jorgecarleitao/arrow2#1312
Labels
bug Something isn't working python Related to Python Polars

Comments

@Vincenthays
Copy link
Contributor

Vincenthays commented Nov 28, 2022

Polars version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Issue description

The default engine crash when reading an empty categorical column, whereas pyarrow is working as expected

Reproducible example

import polars as pl

pl.DataFrame({'a': pl.Series([None], dtype=pl.Categorical)}).write_parquet('test.pq')

pl.read_parquet('test.pq', use_pyarrow=True) # working with pyarrow
pl.read_parquet('test.pq')                   # not working without pyarrow
pl.scan_parquet('test.pq').collect()         # not working without pyarrow

Expected behavior

>> import polars as pl
>> pl.DataFrame({'a': pl.Series([None], dtype=pl.Categorical)}).write_parquet('test.pq')
>> pl.read_parquet('test.pq')
shape: (1, 1)
│   a   │
│ ----- │
│  cat  │
│═══════│ 
|  null |
>> pl.scan_parquet('test.pq').collect()
shape: (1, 1)
│   a   │
│ ----- │
│  cat  │
│═══════│ 
|  null |

Installed versions

---Version info---
Polars: 0.15.1
Index type: UInt32
Platform: macOS-13.0.1-arm64-arm-64bit
Python: 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)]
---Optional dependencies---
pyarrow: 10.0.1
pandas: 1.5.2
numpy: 1.22.4
fsspec: 2022.11.0
connectorx: 0.3.1
xlsx2csv: <not installed>
matplotlib: <not installed>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant